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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int N, M, sum;
    while( cin >> N >> M, N | M ){
        sum = 0;
        vector<P> d( N );
        REP( i, N ) {
            cin >> d[i].second >> d[i].first;
            sum += d[i].first * d[i].second;
        }

        sort( ALL( d ), greater<P>() );

        REP( i, N ){
            if( M >= d[i].second ){
                M -= d[i].second;
                sum -= d[i].second * d[i].first;
            }else{
                sum -= d[i].first * M;
                break;
            }
        }

        cout << sum << endl;
    }
}


Measured memory_bytes: 3204
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

main:-
    get_number(X),
    (X mod 10 =:= 7 ; X div 10 mod 10 =:= 7 ; X div 100 mod 10 =:= 7) -> writeln("Yes") ; writeln("No").


Measured memory_bytes: 8084
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <complex>
#include <fstream>
#include <cmath>

using namespace std;

int main(void){
    int a, b;
    cin >> a >> b;
    cout << (((a+b) % 3 == 0 || a%3==0 || b%3==0 ) ? "Possible" : "Impossible" ) << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    val (ga, sa, ba) = readLine()!!.split(" ").map { it.toInt() }
    val (gb, sb, bb) = readLine()!!.split(" ").map { it.toInt() }
    val n2 = solve(n, ga, sa, ba, gb, sb, bb)
    val n3 = solve(n2, gb, sb, bb, ga, sa, ba)
    println(n3)
}

const val M = 100000

fun solve(n: Long, ga: Int, sa: Int, ba: Int, gb: Int, sb: Int, bb: Int): Long {
    val nInt = n.toInt()
    val dp = LongArray(M)
    for (i in 1..nInt) {
        var value = i.toLong()
        if (i >= ga && ga < gb) {
            value = Math.max(value, dp[(i - ga + M) % M] + gb)
        }
        if (i >= sa && sa < sb) {
            value = Math.max(value, dp[(i - sa + M) % M] + sb)
        }
        if (i >= ba && ba < bb) {
            value = Math.max(value, dp[(i - ba + M) % M] + bb)
        }
        dp[i % M] = value
    }
    return dp[nInt % M]
}


Measured memory_bytes: 40816
#include <stdio.h>

int main(void)
{
    char s[5] = {0};

    scanf("%s", s);

    if (s[0]==s[1] && s[1]==s[2] || s[1]==s[2] && s[2]==s[3])   printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N, A, B[100001] = {};

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A;
		B[A] = i;
	}
	for (int i = 1; i <= N; i++)cout << B[i] << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int count;

void insertionSort(int *, int, int);
void shellSort(int *, int);

int main(void)
{
  int n, *A, i;
  scanf(" %d", &n);
  A = (int *) malloc(sizeof(int[n]));
  for (i = 0; i < n; i++)
    scanf(" %d", A + i);
  shellSort(A, n);
  printf("%d\n", count);
  for (i = 0; i < n; i++)
    printf("%d\n", A[i]);
  return 0;
}

void insertionSort(int *A, int n, int g)
{
  int i;
  for (i = g; i < n; i++)
    {
      int value = A[i];
      int j = i - g;
      while (j >= 0 && A[j] > value)
	{
	  A[j+g] = A[j];
	  j = j - g;
	  count++;
	}
      A[j+g] = value;
    }
}

void shellSort(int *A, int n)
{
  count = 0;
  int m = (int) log((double) n);
  if (m == 0)
    m = 1;
  printf("%d\n", m);
  int i;
  int *G = (int *) malloc(sizeof(int[m]));
  for (i = m - 1; i >= 0; i--)
    G[i] = pow(2, m - i - 1);
  for (i = 0; i < m; i++)
    printf("%d%s", G[i], i != m - 1 ? " " : "\n");
  for (i = 0; i < m; i++)
    insertionSort(A, n, G[i]);
}



Measured memory_bytes: 5908
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

vector<lint> divisors(lint n) {
  vector<lint> res;
  for (lint i = 1; i * i <= n; ++i) {
    if (n % i != 0) continue;
    res.push_back(i);
    if (n / i == i) continue;  // 上の行で追加済み。
    res.push_back(n / i);
  }
  return res;
}

// 最大公約数
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool is_prime(lint n) {
  for (lint i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

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

  lint A, B;
  cin >> A >> B;

  vector<lint> A_div, B_div, AB_div;
  A_div = divisors(A);
  B_div = divisors(B);
  sort(all(A_div));
  sort(all(B_div));
  lint a = 0, b = 0;
  while (a < A_div.size() && b < B_div.size()) {
    if (A_div[a] == B_div[b]) {
      AB_div.push_back(A_div[a]);
      a++;
      b++;
    } else {
      if (A_div[a] < B_div[b]) {
        a++;
      } else {
        b++;
      }
    }
  }

  lint res = 0;
  rep(i, (int)AB_div.size()) {
    if (is_prime(AB_div[i])) res++;
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <memory>
#include <iomanip>
#include <numeric>
#include <functional>
#include <new>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <climits>
#include <cctype>
#include <ctime>

#define REP(i, n) for(int (i) = 0; i < n; i++)
#define FOR(i, a, n) for(int (i) = a; i < n; i++)
#define FORR(i, a, n) for(int (i) = a; i <= n; i++)
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++)
#define sz(n) n.size()
#define pb(n) push_back(n)
#define all(n) n.begin(), n.end()

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

using namespace std;

typedef long long ll;
typedef long double ld;

int d;

int main(void) {
    for( ; ~scanf("%d", &d); ) {
        int ans = 0;

        for(int i = 0; i < 600; i += d) {
            ans += (i * i) * d;
        }

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

    }
    return 0;
}

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

int main(){
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = A;
  int b = B;
  int c = C;
  int d = D;
  int e = E;
  if(a % 10 != 0) a = A / 10 * 10 + 10;
  if(b % 10 != 0) b = B / 10 * 10 + 10;
  if(c % 10 != 0) c = C / 10 * 10 + 10;
  if(d % 10 != 0) d = D / 10 * 10 + 10;
  if(e % 10 != 0) e = E / 10 * 10 + 10;
  int sum = a + b + c + d + e;
  int sumA = sum - a + A;
  int sumB = sum - b + B;
  int sumC = sum - c + C;
  int sumD = sum - d + D;
  int sumE = sum - e + E;
  int ans = min(sumA, sumB);
  ans = min(ans, sumC);
  ans = min(ans, sumD);
  ans = min(ans, sumE);
  cout << ans << endl;
}
  

Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    println!("{}",(read::<i32>()-1)*(read::<i32>()-1))
}


Measured memory_bytes: 4352
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		
		string result;
		if (a * b % 2 == 1) {
		    result = "Odd";
		} else {
		    result = "Even";
		}
		//出力
		Console.WriteLine(result);
	}
}

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

int main() {
    string S,T,U;
    int A, B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    if(S == U) cout << A - 1 << ' ' << B << endl;
    else cout << A << ' ' << B - 1 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

     static Scanner scanner;

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

         int N=gi();
         int X=gi();
         int T=gi();
         long[] A=new long[N];

         int a=Math.floorDiv(N, X);
         if(N%X!=0)a++;
         long ans=a*T;


         System.out.println(ans);

     }

     public static long f(int n, int s, int e) {
    	 if(s<=e) {
    		 return e-s;
    	 } else {
    		 return n-s+e;
    	 }
     }

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 35604
n = int(input())
s = [p for p in input()]
w = [0]
e = [0]
mn = float("inf")
for i in range(n):
  if s[i] == 'W':
  	w.append(w[i]+1)
  else:
    w.append(w[i])
  e.append(i+1-w[i+1])
for i in range(n):
  if w[i]+e[n]-e[i+1] < mn:
    mn = w[i]+e[n]-e[i+1]
print(mn)

Measured memory_bytes: 27212
#include <bits/stdc++.h>
using namespace std;
int main (){
    int N,A,B,sum=0,ans=0,i,x;
    cin >> N >> A >> B;

    for(i=1;i<N+1;i++){
        x = i;
        while(true){
            sum += x % 10 ;
            x /= 10;
            if(x < 1) break;
            }
        if(A <= sum && sum <= B){
                ans += i;
        }
        sum = 0; 
    }
    cout << ans << endl;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if (a+b+c==17){
    if((a==7&&b==5)||(a==5&&b==7)||(b==5&&c==7))
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
   else{
     cout << "NO" << endl;
   }
  
  return 0;
}
   

Measured memory_bytes: 256
h, w = gets.chomp.split(" ").map(&:to_i)
  a = []
  h.times do |i|
    a[i] = gets.chomp
  end
  puts "#"*(w+2)
  h.times do |i|
    puts "##{a[i]}"+"#"
  end
  puts "#"*(w+2)

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,a,ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==1&&i%2==0)
            ans++;
    }
    cout<<ans<<endl;
}


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


#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int N = 2e5 + 10;


using namespace std;




int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

    int n;
    cin >> n;
    int a[n];

    int ans = 0;

    loop(i, n)
    {
        cin >> a[i];
    }


    for (int i = 0; i < n; i = i + 2)
    {
        if (a[i] % 2 == 1)
        {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3596
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

A.sort(reverse=True)
sm = sum(A)

A = A[:M]
ans = None

# A[-1] < sm * (1/4M)
if 4 * M * A[-1] < sm:
    ans = False
else:
    ans = True

if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
n = int(input())
lst = list(map(int, input().split()))
	
suffS = []
lst = lst[::-1]
summ = 0
for i in lst:
	suffS.append(summ)
	summ += i
res = 0
for i in range(n):
	res += suffS[i] * lst[i]
	res %= (10**9+7)
print(res)


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

using namespace std;

typedef long long LL;

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

   int k[a];

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

   sort(k, k + a);

   int sum = 0;

   for(int i = 0; i < b; i++){
    sum += k[i];
   }

   cout << sum << "\n";

}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace _gnu_pbds;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(),a.end()
#define fr(i,a,b) for(ll i = a ; i < b ; i++)
#define stoink stack<ll>
#define quu queue<ll>
#define quee queue<pair<ll,ll>>
#define vec vector <ll>
#define vecd vector<ld>
#define vg vector<vector<ll> >
#define eg vector<pair<ll,ll>>
#define vgw vector<vector<pair<ll,ll> > >
#define pa pair<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define pre 0.00000000000000000001
#define inf 100000000
#define mod (ll)(1e9+7)
#define endl '\n'
string k;   
ll d;
ll dp[105][10005][2];
ll n;
bool active = false;
ll func(ll pos,bool rest,ll sum) {
    if(pos == 1){
        if(sum == 0)
            return 1;
        else
            return 0;
    }
    if(dp[sum][pos][rest] != -1)
        return dp[sum][pos][rest];
    ll ans = 0;
    if(rest) {
        fr(i,0,10){
            if(i + 48 == k[n - pos + 1])
                break;
            ans = (ans + func(pos - 1,false,(sum + i) % d)) % mod;
        }
        ans = (ans + func(pos - 1,true,(sum + k[n - pos + 1] - 48) % d)) % mod;
    }
    else {
        fr(i,0,10) {
            ans = (ans + func(pos - 1,false,(sum + i) % d)) % mod;        
        }
    }
    return dp[sum][pos][rest] = ans;
}   
int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    memset(dp,-1,sizeof(dp));
    cin >> k;
    cin >> d;
    n = k.length();
    ll res = 0;
    fr(i,0,10) {
        if(i + 48 == k[0])
            break;
        res = (res + func(n,false,i % d)) % mod;
    }
    res = (res + func(n,true,(k[0] - 48) % d)) % mod;
    if(res == 0)
        cout << mod - 1;
    else
        cout << res - 1;    
    return 0;
}   


Measured memory_bytes: 20864
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> v(n), c(n);
  REP(i, n) cin >> v[i];
  REP(i, n) cin >> c[i];
  int ans = 0;
  REP(i, n) {
    if (v[i] - c[i] >= 0) ans += v[i] - c[i];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import math
N = int(input())
a = list(map(int, input().split()))
a.sort()

ans = math.inf
for i in range(a[0], a[-1]+1):
  tmp = 0
  for j in range(N):
    tmp += (a[j]-i) ** 2
  if ans >= tmp:
    ans = tmp
  else:
    break
print(ans)

Measured memory_bytes: 9192
/// d.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < ll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int s[1 << 20];
int n;
int get(void)
{
    int a = 0,b = 0,c = 1;
    for (int i = 1;i <= n;++i)
    {
        if (s[i] & 1)
            ++a,c = s[i];
        else
            ++b;
    }
    if (b & 1) return 1;
    else
    if (a > 1 || c == 1) return 0;
    else
    {
        for (int i = 1;i <= n;++i)
            if (s[i] & 1)
                --s[i];
        int g = 0;
        for (int i = 1;i <= n;++i)
            g = __gcd(g,s[i]);
        for (int i = 1;i <= n;++i)
            s[i] /= g;
        return 1 - get();
    }
}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    IOS;
    fi>>n;
    for (int i = 1;i <= n;++i)
        fi>>s[i];
    puts(get() ? "First" : "Second");
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {

		int n = sc.nextInt();
		
		int A[] = new int[n+1];
		int B[] = new int[n+1];
		for(int i =0 ; i < n ;i++){
			A[i+1] = A[i]+sc.nextInt(); 
		}
		for(int i =0 ; i < n ;i++){
			B[i+1] = B[i]+sc.nextInt(); 
		}
		
		int max = 0;
		for(int i = 1 ; i < n+1 ; i++){
			max = Math.max(max,(A[i] + B[n] - B[i-1]));
		}
		
		System.out.println(max);
		
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

string S, T;
int main() {
    while (cin >> S >> T) {
        map<char,int> sm, tm;
        for (int i = 0; i < S.size(); ++i) sm[S[i]]++;
        for (int i = 0; i < T.size(); ++i) tm[T[i]]++;
        vector<long long> sv, tv;
        for (auto it = sm.begin(); it != sm.end(); ++it) sv.push_back(it->second);
        for (auto it = tm.begin(); it != tm.end(); ++it) tv.push_back(it->second);
        sort(sv.begin(), sv.end());
        sort(tv.begin(), tv.end());
        if (sv == tv) puts("Yes");
        else puts("No");
    }
}


Measured memory_bytes: 776
N, x = map(int, input().split())
alist = list(map(int, input().split()))
alist.sort()
 
def counter(x, alist):
  count = 0
  while x > 0:
      if alist:
          tmp = alist.pop(0)
          x = x - tmp
          if x == 0:
              return count + 1
          elif x > 0:
              count += 1
          else:
              return count
      else:
          return count - 1
print(counter(x, alist))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
    #include<chrono>
     
    using namespace std;
    using namespace std::chrono;
    typedef long long ll;
    typedef vector<int> vi;
    typedef pair<int,int> pi;
    #define F first
    #define S second
    #define PB push_back
    #define EB emplace_back
    #define MP make_pair
    #define REP(i,a,b) for(i=a;i<=b;i++)
    #define RAP(i,a,b) for(i=a;i>=b;i--)

    int main(){
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    	int r;
    	cin>>r;
        cout<<r*r<<"\n";
        return 0;	
    }

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

int main()
{
   static long i,j,k,l;
   long n;
   long cnt = 0;
   long left,right,mid;
   long ans = 0;
   int a,b;
   static int H[10000];
   static int W[10000];


   for(i = 0;; i++) {
      scanf("%d %d",&H[i],&W[i]);
      if(H[i] == 0)
         break;
   }
   for(j = 0; j < i; j++) {
      for(k = 0; k < H[j]/2; k++) {
         for(l = 0; l < W[j]/2; l++) 
            printf("#.");
         if(W[j] % 2)
            putchar('#');
         puts("");
         for(l = 0; l < W[j]/2; l++) 
            printf(".#");
         if(W[j] % 2)
            putchar('.');
         puts("");
      }
      if(H[j] % 2) {
         for(l = 0; l < W[j]/2; l++) 
            printf("#.");
         if(W[j] % 2)
            putchar('#');
         puts("");
      }
      puts("");
   }


   return 0;
}

Measured memory_bytes: 1036
N =int(input())
S = ""
Alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
while N>26:
    N-=1
    S=Alpha[N%26]+S
    N=N//26
N-=1
S=Alpha[N%26]+S
print(S)

Measured memory_bytes: 9184
#include<stdio.h>
int main(){
	int a;
	while(scanf("%d",&a),a){
		int sum=0;
		for(int i=0;i<a*(a-1)/2;i++){
			int c;
			scanf("%d",&c);
			sum+=c;
		}
		printf("%d\n",sum/(a-1));
	}
}

Measured memory_bytes: 0
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int N;
	cin>>N;
	VI A(N);
	REP(i,N){
		cin>>A[i];
		A[i]-=i;
		A[i]--;
	}
	SORT(A);
	//REP(i,N)cout<<A[i]<<endl;
	int AVE[3];
	ll ans=LLINF;
	if(N<4){
		REP(i,N)AVE[i]=A[i];
		REP(i,3){
			ll cnt=0;
			REP(j,N)
				cnt=abs(A[j]-AVE[i]);
			ans=min(ans,cnt);
		}
	}
	else{
		AVE[0]=A[N/2-1];
		AVE[1]=A[N/2];
		AVE[2]=A[N/2+1];
		//REP(i,3)cout<<AVE[i]<<endl;
		REP(i,3){
			ll cnt=0;
			REP(j,N)
				cnt+=abs(A[j]-AVE[i]);
			//cout<<cnt<<endl;
			ans=min(ans,cnt);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin>>n;
	for(ll a = -120;a<=120;a++)
	{
		for(ll b = -120;b<=120;b++)
		{
			ll k,l;
			k = pow(a,5);
			l = pow(b,5);
			if(k-l == n)
			{
				cout<<a<<" "<<b<<endl;
				return 0;
			}
		}
	}
 } 

Measured memory_bytes: 4104
#include <stdio.h>
#include <string.h>

char input[600];

int catcheck(int start,int end) {
	int i;
	int kaisou;
	if(start>=end)return 1;
	if(input[start]!='m' || input[end-1]!='w')return 0;
	kaisou=0;
	for(i=start+1;i<end-1;i++) {
		if(kaisou==0 && input[i]=='e')break;
		if(input[i]=='m')kaisou++;
		if(input[i]=='w')kaisou--;
		if(kaisou<0)return 0;
	}
	return catcheck(start+1,i) && catcheck(i+1,end-1);
}

int main(void) {
	scanf("%s",input);
	puts(catcheck(0,strlen(input))?"Cat":"Rabbit");
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int a, b; scanf("%d%d", &a, &b);
  if (a < 10 && b < 10) printf("%d", a*b);
  else puts("-1");
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3808
#include <stdio.h>
#define MAX 1000000007
int main(void){
    // Your code here!
    
    int A,B;
    
    scanf("%d %d\n",&A,&B);
    if(B==1) printf("0\n");
    else{
        int kosu = 1;
        int flag = 1;
        while(flag){
            if(kosu*A-(kosu-1) >= B) flag = 0;
            else                    kosu++;
        }
    
        printf("%d\n",kosu);
    }

    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define		CH		ch=(getchar())

inline		int		IN(){
	int x=0,f=1;char ch;
	for (CH;ch>'9'||ch<'0';CH) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';CH) (x*=10)+=ch-'0';
	return x*f;
}

int i,j,k,l,n,m;

int main(){
	scanf("%d",&n);
	for (m=1;m<=n;m<<=1);m>>=1;
	printf("%d",m);
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el cout << "\n"
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);
ll n,m;
vector <string> A;

ll nbr[2002][2002][4];
int main()
{
    IOS;
    cout.precision(30);
    string s;
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
    {
        cin >> s;
        A.push_back(s);
    }
    ll ANS=0;
    memset(nbr,0,sizeof nbr);
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=m;j++)
        {
            if (A[i-1][j-1]=='.')
            {
                nbr[i][j][0]=nbr[i][j-1][0]+1;
            }
        }

    }

    for (int j=1;j<=m;j++)
    {
        for (int i=1;i<=n;i++)
        {
            if (A[i-1][j-1]=='.')
            {
                nbr[i][j][1]=nbr[i-1][j][1]+1;
            }
        }

    }

    for (int i=n;i>=1;i--)
    {
        for (int j=m;j>=1;j--)
        {
            if (A[i-1][j-1]=='.')
            {
                nbr[i][j][2]=nbr[i][j+1][2]+1;
            }
        }
    }

    for (int j=m;j>=1;j--)
    {
        for (int i=n;i>=1;i--)
        {
            if (A[i-1][j-1]=='.')
            {
                nbr[i][j][3]=nbr[i+1][j][3]+1;
            }
        }
    }

    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=m;j++)
        {
            ll ans=0;
            if (A[i-1][j-1]=='.')
            {
                for (int k=0;k<4;k++)
                {
                    ans+=nbr[i][j][k];
                }
                ANS=max(ANS,ans-3);
            }
        }
    }
    cout << ANS << "\n";
}



Measured memory_bytes: 132556
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  vector<vector<int>> v(3, vector<int>(3)), u(3, vector<int>(3));
  rep(i,3) rep(j,3) cin >> v[i][j];
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i,n) cin >> b[i];
  rep(i,n) {
    int t = b[i];
    rep(j,3) rep(k,3) if (v[j][k] == t) u[j][k] = 1;
  }
  bool is = false;
  rep(i,3) {
    if (u[i][0] && u[i][1] && u[i][2]) is = is || true;
  }
  rep(i,3) {
    if (u[0][i] && u[1][i] && u[2][i]) is = is || true;
  }
  if (u[0][0] && u[1][1] && u[2][2]) is = is || true;
  if (u[0][2] && u[1][1] && u[2][0]) is = is || true;
  cout << (is? "Yes": "No") << endl;

}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3576
x,n = map(int,input().split())
if n == 0:
    print(x)
    exit()
l = set(list(map(int,input().split())))
for i in range(max(x,100-x)+1):
    if x-i not in l:
        print(x-i)
        exit()
    if x+i not in l:
        print(x+i)
        exit()

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

int main() {
    int N;
    int d[110];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> d[i];

    int num[110] = {0};  // バケット
    for (int i = 0; i < N; ++i) {
        num[d[i]]=num[d[i]]+1;  // d[i] が 1 個増える
    }

    int res = 0;  // 答えを格納
    for (int i = 1; i <= 100; ++i) {  // 1 <= d[i] <= 100 なので 1 から 100 まで探索
        if (num[i]) {  // 0 より大きかったら
            ++res;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n,i,a[200006];
long long ans=0ll,x,y,b=-1ll;
int main()
{
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        ans+=(long long)a[i];
    }
    for(i=1,x=0;i<n;i++)
    {
        x+=a[i];
        y=(ans-2*x>=0)?(ans-2*x):(2*x-ans);
        if(y<b || b==-1)
            b=y;
    }
    printf("%lld",b);
    return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public static void Solve()
    {
        NX N = NextLong();
        NX M = (NX)Math.Sqrt(N);
        NX ans = N - 1;
        for (NX i = 1; i <= M; i++)
        {
            if (N % i == 0) { ans = Math.Min(ans, (N / i + i) - 2); }
        }
        Console.WriteLine(ans);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 13268
import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = [100,101,102,103,104,105]
dp = [[False]*(N+1) for i in range(6+1)]
dp[0][0] = True

for i in range(1,6+1):
  for j in range(N+1):
    if dp[i - 1][j] == True:
      k = 0
      while 0 <= (j + a[i - 1]*k) < N+1:
        dp[i][j + a[i - 1]*k] = True
        k += 1
print(int(dp[-1][-1]))

Measured memory_bytes: 46188
import java.util.Scanner;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        String S = sc.next();

        char[] charArray = S.toCharArray();
        charArray[K-1] = Character.toLowerCase(charArray[K-1]);
        String result = new String(charArray);
        System.out.println(result);
        
    }
}

Measured memory_bytes: 21844
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD (100000009)
#define INF (100000009)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n;
int h[MAXN];
int m[MAXN];

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

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

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

	ll res = 0;

	for (int i = n; i > 0; --i)
	{
		if(m[i] > h[i-1])
		{
			res += h[i-1];
			h[i-1] = 0;
		}	
		else
		{
			res += m[i];
			h[i-1] -= m[i];
			res += min(h[i-1],m[i-1]);
			m[i-1] -= min(h[i-1],m[i-1]);
		}
	}

	cout << fixed << res << endl; 
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
	char s[101];
	scanf("%s",s);
	if(strcmp(s,"SUN")==0){
	    printf("7\n");
	}else if(strcmp(s,"MON")==0){
	    printf("6\n");
	}else if(strcmp(s,"TUE")==0){
	    printf("5\n");
	}else if(strcmp(s,"WED")==0){
	    printf("4\n");
	}else if(strcmp(s,"THU")==0){
	    printf("3\n");
	}else if(strcmp(s,"FRI")==0){
	    printf("2\n");
	}else if(strcmp(s,"SAT")==0){
	    printf("1\n");
	}
	
	return 0;
}

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

int main() {
    int h, w;
    while (true) {
      cin >> h >> w;

      if (h == 0 && w ==0) break;

      for (int i = 1; i <= h; i++) {
          for (int j = 1; j <= w; j++) {
              cout << "#";
          }
          cout << endl;
      }
      cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#70 C - 100 to 105 WA
X = int(input())

dp = [0]*(100010)
lst = [100,101,102,103,104,105]
for i in range(100,106):
    dp[i] = 1

# dp[v] が存在するなら 1, しないなら 0
for v in range(100,X+1):
    for w in range(6):
        n = lst[w]
        if dp[v-n] == 1:
            dp[v] = 1
print(dp[X])

Measured memory_bytes: 9684
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 100000;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool dp[100005];
signed main() {
    int N,K;
    cin >> N >> K;
    vector<int>a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    for(int i = 0; i <= K; i++) {
        for(int j = 0; j < N; j++) {
            if(i-a[j] >= 0) {
                if(dp[i-a[j]] == false) {
                    dp[i] = true;
                }
            }
        }
    }
    if(dp[K]) {
        cout << "First" << endl;
    }
    else {
        cout << "Second" << endl;
    }
}


Measured memory_bytes: 3732
n = int(input())
l = list(map(int, input().split()))
l.sort()
def bin_search(key, list):
    ok = n
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if list[mid] > key:
            ok = mid
        else:
            ng = mid
    return ok

ans = 0
for i in range(1, n - 1):
    for j in range(i + 1, n):
        c_min_len = l[j] - l[i]
        x = i - bin_search(c_min_len, l)
        ans += max(0, x)
print(ans)

Measured memory_bytes: 45020
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	int N, A, B;

	cin >> N >> A >> B;
	cout << min(N * A, B) << endl;
}



Measured memory_bytes: 256
import * as fs from 'fs';

//in
// 3 5 7
//out
// 10
const main = (inp: string) => {
    const [a, b, t] = inp.split(' ').map(Number);
    console.log(Math.floor(t / a) * b);

};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());


Measured memory_bytes: 7372
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    string s,t;
    cin>>s>>t;
    string c = t + s;
    cout<<c;
}

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

const ll mod=1000000007;

int main() {
  int n,k,count=0;
  cin >> n >> k;
  map<int,int> mp;
  while(k--){
    int a;
    cin >> a;
    r(i,a){
      int b;
      cin >> b;
      mp[b-1]++;
    }
  }
  r(i,n)if(mp[i]==0)count++;
  cout<<count<<endl;
}

Measured memory_bytes: 3632
<?php

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


while(fscanf(STDIN, "%d %d", $a, $b)){
    $gcd = gcd($a, $b);
    $lcm = ($a * $b) / $gcd;
    printf("%d %d\n", $gcd, $lcm);
}


Measured memory_bytes: 9232
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var S = lines[0]; var T = lines[1];
    var len = S.length;

    var start = Array(26).fill(-1);
    var goal = Array(26).fill(-1);

    for (var i = 0; i < len; i++) {
        var a = S.charCodeAt(i) - 97;
        var b = T.charCodeAt(i) - 97;
    
        if (start[a] !== -1 || goal[b] !== -1) {
            if (start[a] !== b || goal[b] !== a) {
                console.log("No"); return (0);
            }
        }
        else {
            start[a] = b; goal[b] = a;
        }
    }
    console.log("Yes");
});

Measured memory_bytes: 8268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dbl;
#define sqr(int) (int * int)
#define sqr3(int) (int * int * int)
#define pi M_PI
#define n "\n"


	
  void solve(){
	  int a,b,c;
	  cin >> a >> b >> c;
	  int x=0,y=0;
	  if(a == 5){x+=1;}
	  if(a == 7){y+=1;}
	  if(b == 5){x+=1;}
	  if(b == 7){y+=1;}
	  if(c == 5){x+=1;}
	  if(c == 7){y+=1;}
	  
	  if(x == 2 && y == 1){
		  cout << "YES";
	  }
	  else{
		  cout << "NO";
	  }
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  int main(){
	ios::sync_with_stdio(true);
	cin.tie(0);
	solve();
}
	
	

		
		
		
		
	





Measured memory_bytes: 3504
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
if n%2==0:
  print(a[0]+sum(a[1:int(n/2)])*2)
else:
  print(a[0]+sum(a[1:int((n-1)/2)])*2+a[int((n+1)/2-1)])
  
  
        

Measured memory_bytes: 31576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 100100
const ll inf = (ll)1e10;
ll dp[MAXN];
int n, h[MAXN],k;
ll solve( int pos ) {
	if ( pos == n ) return 0;
	if ( dp[pos] != -1 ) return dp[pos];
	ll ret = inf;
	for ( int i = 1; i <= 2; i++ ) {
		if ( pos + i <= n ) {
			ret = min(ret,solve(pos+i)+abs(h[pos]-h[pos+i]));
		}
	}
	return dp[pos] = ret;
}
int main()
{
	#ifdef __APPLE__
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for ( int i = 1; i <= n; i++ ) cin >> h[i];
	memset(dp,-1,sizeof(dp));
	cout << solve(1) << endl;
	return 0;
}



Measured memory_bytes: 6144
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

using lint = long long;
using ldouble = long double;

ldouble P, E, T;

ldouble calc(int k, ldouble L, ldouble R) {
    if (T + E < L || R < T - E) return 0;
    if (T - E < L && R < T + E) return 1;

    ldouble H = (L + R) / 2;
    if (k == 0) {
        return (T - E < H && H < T + E);
    }

    if (H > T) {
        return calc(k - 1, L, H) * (1 - P) + calc(k - 1, H, R) * P;
    } else {
        return calc(k - 1, L, H) * P + calc(k - 1, H, R) * (1 - P);
    }
}

int main() {
    int K;
    ldouble L, R;
    cin >> K >> L >> R >> P >> E >> T;
    cout << fixed << setprecision(6) << calc(K, L, R) << endl;
    return 0;
}



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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n;
    while (cin >> n, n) {
        vector<double> a(n);
        double ave = 0;
        rep(i, n) {
            cin >> a[i];
            ave += a[i];
        }
        ave /= n;
        int ans = 0;
        rep(i, n) {
            if (ave >= a[i]) ans++;
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3272
#include<stdio.h>

int main(){
    int r,c,sum;
    scanf("%d %d",&r,&c);
    int table[r+1][c+1] = {};
    for(int i = 0;i < r;i++){
        for(int j = 0;j < c;j++){
            scanf("%d",&table[i][j]);
            table[r][j] += table[i][j];
            table[i][c] += table[i][j];
            table[r][c] += table[i][j];
        }
    }
    table[r+1][c+1] = sum;
    
    for(int i = 0;i < r+1;i++){
        for(int j = 0;j < c+1;j++){
            if(j != c){
                printf("%d ",table[i][j]);
            } else {
                printf("%d\n",table[i][j]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2720
import copy

def fast_pow(x, n, MOD):
    res = 1
    while n:
        if n & 1:
            res = res * x % MOD
        x = x * x % MOD
        n >>= 1
    return res
  
  
def prepare(n, MOD):
 
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

MOD = 10**9+7
fact, fact_inv = prepare(2*10**5, MOD)

n, a, b = map(int,input().split())
f = copy.deepcopy(n)
for i in range(1, b+1):
    if i == a:
        nca = f * fact_inv[a] % MOD
    if i == b:
        ncb = f * fact_inv[b] % MOD
        break
    f = f * (n - i) % MOD
print((fast_pow(2, n, MOD) - 1 - nca - ncb) % MOD)



Measured memory_bytes: 24932
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int renban=1;
    int ans=0;
    rep(i,n){
        if(a[i] == renban) renban++;
        else ans++;
    }
    if(ans == n)cout << -1 << endl;
    else        cout << ans << endl;
}

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

int main()
{
   long long n,m,sum=0;
   cin>>n>>m;
   long long arr[m];
   for(int i=1;i<=m;i++)
   {
       cin>>arr[i];
       sum=sum+arr[i];
   }
   long long ans=n-sum;
   if(ans>=0)
    cout<<ans<<endl;
    else
        cout<<-1<<endl;
    return 0;

}


Measured memory_bytes: 3716
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>
#include <math.h>

using namespace std;
typedef long long ll;
///定義場所///
ll i, j, k, l, m, n;
ll N, M, K, H, W, T, P;
ll MOD = 1000000007;
ll ans = 0;
//関数リスト//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
//(注)pairの型・比較する場所(first/second)は毎回変えて使用する
bool pairCompare(const pair<int ,int> firstElof, pair<int,int> secondElof)
{
	return firstElof.second < secondElof.second;
}
int Keta(ll F) {
	int keta = 1;
	while (F/10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
//////////////

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

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

#define rep(i,n) for(int i = 0; i < (n); i++)

int main () {
    string S;
    cin >> S;
    if(S[S.length()-1] != 's') 
        cout << S << 's' << endl;
    else
        cout << S << "es" << endl;
    return 0;
}

Measured memory_bytes: 3624