akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{

    lli a, b, n;
    cin>>a>>b>>n;
    n = min(b - 1, n);
    lli ans = (a * n) / b;
    ans -= a  * (n / b);
    cout<<ans;
    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

int main() {
    fast;
    ll a; cin>>a;
    multiset<ll> s;
    for(int q=0; q<a; q++){
        ll x; cin>>x;
        if(s.size()==0){
            s.insert(x);
            continue;
        }
        auto it = s.lower_bound(x);
        if(it==s.begin()){
            s.insert(x);
            continue;
        }
        it--;
        s.erase(it);
        s.insert(x);
    }
    cout<<s.size();
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

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

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


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

    int a, b, h;
    cin >> a >> b >> h;

    int ans = (a + b) * h / 2;

    cout << ans << 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++)

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

  bool a = false;
  int count = 0;
  int ans = 0;

  rep(i, str.length()){
    if(a){
      count++;
      if(str.at(i) == 'Z'){
        ans = count;
      }
    }
    else{
      if(str.at(i) == 'A') {
        a = true;
        count++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s.substr(i, 1) == s.substr(i + 1, 1)) {
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}


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

void findDivisors(ll n)
{
    ll ans = 0,i,j, k;
    for(j=1;j<=n;j++){
        k=n/j;
        k=k*(k+1);
        k=k/2;
        ans+=(k*j);
    }

    cout<<ans<<endl;
}

// Driver code
int main()
{
	ll n;
	cin>>n;
	findDivisors(n);

	return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<cmath>
#define N 0.000001
using namespace std;

int main(){
  double x1,y1,x2,y2,x3,y3,px,py;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
    double s1=0,s2=0,s3=0,s=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,a2=0,b2=0,c2=0,a3=0,b3=0,c3=0;
    a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s=(a+b+c)/2;
    s=sqrt(s*(s-a)*(s-b)*(s-c));

    a1=sqrt((px-x2)*(px-x2)+(py-y2)*(py-y2));
    b1=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c1=sqrt((x3-px)*(x3-px)+(y3-py)*(y3-py));
    s1=(a1+b1+c1)/2;
    s1=sqrt(s1*(s1-a1)*(s1-b1)*(s1-c1));

    a2=sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
    b2=sqrt((px-x3)*(px-x3)+(py-y3)*(py-y3));
    c2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s2=(a2+b2+c2)/2;
    s2=sqrt(s2*(s2-a2)*(s2-b2)*(s2-c2));

    a3=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b3=sqrt((x2-px)*(x2-px)+(y2-py)*(y2-py));
    c3=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    s3=(a3+b3+c3)/2;
    s3=sqrt(s3*(s3-a3)*(s3-b3)*(s3-c3));

    if((-N<s1 && s1<N) || (-N<s2 && s2<N) || (-N<s3 && s3<N) )cout<<"NO"<<endl;
    else if((s1+s2+s3)>s-N && (s1+s2+s3)<s+N )cout<<"YES"<<endl;
    else  cout<<"NO"<<endl; 
  }
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T,class U> istream& operator >> (istream &is, pair<T,U> &p) {
    is>>p.first>>p.second; return is; }
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(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct { template <typename T> operator T() { T x; cin >> x; return x; } } IN;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

int N,Z,W;
vector<int> c;
int dp[2][2005];
int rec(int p,int i) {
    if(dp[p][i]!=-1) return dp[p][i];
    int ret=(p^1)?INF:0;
    REPF(j,i+1,N+1) {
        int tmp=0;
        if(j==N) {
            tmp=abs(c[i]-c[j]);
        } else {
            tmp=rec(p^1,j);
        }
        if(p^1) chmin(ret,tmp);
        else chmax(ret,tmp);
    }
    return dp[p][i]=ret;
}
signed main() {
    REP(i,2) REP(j,2005) dp[i][j]=-1;
    cin>>N>>Z>>W;
    c.reserve(N+1);
    c.push_back(W);
    REP(i,N) {
        int t=IN;
        c.push_back(t);
    }
    cout<<rec(1,0)<<endl;
    return 0;
}


Measured memory_bytes: 512
N=int(input())
S1=input()
S2=input()
MOD=10**9+7
i=0
tmp=3
ans=1
if 1<N and S1[0]==S1[1]:
    tmp=6
while(i<N):
    if S1[i]==S2[i]:
        ans*=tmp
        ans%=MOD
        tmp=2
    else:
        i+=1
        ans*=tmp
        ans%=MOD
        tmp=1
        if i+2<N and S1[i+1]==S1[i+2]:
            tmp=3
    i+=1
print(ans)


Measured memory_bytes: 38256
import java.io.*;
import java.util.*;
class Main{
  static int n;
  static int m[][];
  static int p[];
  public static void main(String args[])throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    n = Integer.parseInt(br.readLine());
    String s[] = new String[2];
    m = new int[n+1][n+1];
    p = new int[n+1];
    for(int i = 0; i<n; i++){
      s = br.readLine().split("\\s+");
      p[i] = Integer.parseInt(s[0]);
      p[i+1] = Integer.parseInt(s[1]);

    }
    System.out.println(matrixChainOrder());
  }
  static int matrixChainOrder(){
    int q;
    int j;
    for(int i = 1; i<=n; i++){
      m[i][i] = 0;
    }
    for(int l =1; l<n; l++){
      for(int i = 1; i<=n-l; i++){
        j = i+l;
        m[i][j]= (int)Double.POSITIVE_INFINITY;
        for(int k = i; k<j; k++){
          q = m[i][k] + m[k+1][j] + p[i-1] *p[k] *p[j];
          m[i][j] = Math.min(m[i][j],q);
        }
      }
    }
    return m[1][n];
  }
}


Measured memory_bytes: 25228
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int t = 0;
	int m = n;
	while (m) {
		t += m % 10;
		m /= 10;
	}
	if (n % t == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef pair<int, int> pint;
const int dx[4] = {0, 1, -1, 0}, dy[4] = {1, 0, 0, -1};
int W, H;
int solve(vector<string>& fld, int sx, int sy){
    queue<pint> que;
    int res = 0;
    que.push(pint(sx, sy));
    while(!que.empty()){
        pint now = que.front(); que.pop();
        if(fld[now.second][now.first] == '.'){
            res++;
            fld[now.second][now.first] = '#';
        }else
          continue;
        rep(i, 4){
            int nx = now.first + dx[i], ny = now.second + dy[i];
            if(nx < 0 || ny < 0 || W <= nx || H <= ny)
              continue;
            que.push(pint(nx, ny));
        }
    }
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> W >> H && W){
        vector<string> fld(H);
        rep(i, H) cin >> fld[i];
        int sx, sy;
        rep(i, H) rep(j, W)
          if(fld[i][j] == '@'){
              sx = j;
              sy = i;
              fld[i][j] = '.';
              break;
          }
        cout << solve(fld, sx, sy) << endl;
    }
}

Measured memory_bytes: 1244
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  int M = 1e9 + 7;
  vector<int> dp[4][4][4];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        dp[i][j][k] = vector<int>(N + 1, 0);
      }
    }
  }
  
  // 長さ 3 の文字列は AGC, ACG, GAC 以外が許される。
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        if ((i == 0 && j == 1 && k == 2) || (i == 1 && j == 0 && k == 2) || (i == 0 && j == 2 && k == 1)) {
          dp[i][j][k][3] = 0;
        } else {
          dp[i][j][k][3] = 1;
        }
      }
    }
  }
  
  for (int n = 3; n < N; n++) {
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        for (int k = 0; k < 4; k++) {
          if (j == 0 && k == 2) {
            // ?AC の後ろには G 以外が入る
            dp[j][k][0][n + 1] = (dp[j][k][0][n + 1]  + dp[i][j][k][n]) % M;
            dp[j][k][2][n + 1] = (dp[j][k][2][n + 1]  + dp[i][j][k][n]) % M;
            dp[j][k][3][n + 1] = (dp[j][k][3][n + 1]  + dp[i][j][k][n]) % M;
          } else if ((i == 0 && k == 1) || (i == 0 && j == 1) || (j == 0 && k == 1) || (j == 1 && k == 0)) {
            // A?G, AG?, ?AG, ?GA の後ろには C 以外が入る
            dp[j][k][0][n + 1] = (dp[j][k][0][n + 1]  + dp[i][j][k][n]) % M;
            dp[j][k][1][n + 1] = (dp[j][k][1][n + 1]  + dp[i][j][k][n]) % M;
            dp[j][k][3][n + 1] = (dp[j][k][3][n + 1]  + dp[i][j][k][n]) % M;
          } else {
            // 上記以外は n+1 文字目としてなんでも使える
            for (int m = 0; m < 4; m++) {
              dp[j][k][m][n + 1] = (dp[j][k][m][n + 1] + dp[i][j][k][n]) % M;
            }
          }
        }
      }
    }
  }
  
  int ret = 0;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        ret = (ret + dp[i][j][k][N]) % M;
      }
    }
  }
  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

LL N, K;
LL DP[301][101];
LL W[100], V[100];
LL C[100];
int main() {
	cin >> N >> K;
	REP(i, 0, N) {
		cin >> W[i] >> V[i];
		C[i] = W[i] - W[0];
	}
	
	Fill(DP, -INFLL);
	DP[0][0] = 0;

	REP(i, 0, N) {
		REM(w, 0, 301) {
			REM(k, 1, N + 1) {
				if (w - C[i] < 0) continue;
				DP[w][k] = max(DP[w][k], DP[w - C[i]][k - 1] + V[i]);
			}
		}
	}

	LL ans = 0;
	REP(k, 0, N + 1) {
		REP(w, 0, min(K - W[0] * k, 300LL) + 1) {
			ans = max(ans, DP[w][k]);
		}
	}
	cout << ans << endl;

	return 0;
}

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

int max(int a,int b){
  if(a>b) return a;
  else return b;
}
int absolute(int a,int b){
  if(a-b<0) return -(a-b);
  else return a-b;
}
int main(){
  int r,g,b;
  cin >> r >> g >> b;
  
  if( (r*100+g*10+b) % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

void solve(){
	int n;
	cin>>n;
	ll num,den;
	cin>>num>>den;
	for(int i=0;i<n-1;i++){
		// cout<<"num den "<<num<<" "<<den<<endl;
		ll nnum,nden;
		cin>>nnum>>nden;
		ll l = 1;
		ll h = 1e18/max(nnum,nden);
		ll ans = 1;
		while(l<=h){
			ll m = l + (h-l)/2;
			if(num <= m*nnum && den <= m*nden){
				ans = m;
				h = m-1;
			}
			else{
				l = m+1;
			}
		}
		// cout<<ans<<endl;
		num = nnum*ans;
		den = nden*ans;
	}
	cout<<num+den<<endl;
}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <tuple>
#include <utility>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long long int64;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(s.size());
  for (int i = 0; i < s.size(); ++i) {
    a[i] = ((s[i] - 'A') + n) % 26;
  }
  for (int i = 0; i < a.size(); ++i) {
    cout << static_cast<char>((a[i] + 'A'));
  }
  puts("");
  return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
map<ll,pair<ll,ll> > ms;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	rep(i,1,120){
		per(j,-i,i){
			if(i*i*i*i*i - j*j*j*j*j >= 1e9)break;
			ms[i*i*i*i*i - j*j*j*j*j] = mp(i,j);
		}
	}
	ll x;
	cin >> x;
	cout << ms[x].fi << ' ' << ms[x].se;
	return 0;
}


Measured memory_bytes: 3904
import java.util.Scanner;
 
public class Main {
	private class Point {
		int size = 0;
		int[] as = null;
		
		public Point(int dim) {
			this.size = dim;
			this.as = new int[dim];
		}
		
		public void read(Scanner in) {
			for (int i=0; i<this.size; i++) {
				as[i] = in.nextInt();
			}
		}
		
		public boolean isIntegerDiff(Point oth) {
			long diff = 0;
			for (int i=0; i<size; i++) {
				long d = this.as[i] - oth.as[i];
				diff += d * d;
			}
			
			long num = Math.round(Math.sqrt((double)diff));
			if (num * num == diff) {
				return true;
			} else {
				return false;
			}
			
		}
	}
	
	public void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int D = in.nextInt();
		Point[] ps = new Point[N];
		for (int i=0; i<N; i++) {
			ps[i] = new Point(D);
			ps[i].read(in);
		}
		in.close();
		
		long count = 0;
		for (int i=0; i<N; i++) {
			for (int j=i+1; j<N; j++) {
				if (ps[i].isIntegerDiff(ps[j])) {
					count++;
				}
			}
		}
		
		System.out.println(count);
	}
	
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}
 
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
int main(){
    int r,g,b,n;scanf("%d%d%d%d",&r,&g,&b,&n);
    int cnt=0;
    for(int i=0;i<=n;i+=r){
        for(int j=0;j<=n;j+=g){
            if(i+j>n)continue;
            int k=n-i-j;
            if(k%b==0)cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))
#define PB push_back
#define MP make_pair

using namespace std;

const double eps = 1e-8;

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

int main() {
    int r;
    cin >> r;
    cout << 3 * (r * r);
    return 0;
}


Measured memory_bytes: 764
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn insert(dp: &mut Vec<i32>, l: usize, r: usize, a: i32) {
    if l + 1 >= r {
        dp[r] = a;
    } else {
        let m = (l + r) / 2;
        if a <= dp[m] {
            insert(dp, l, m, a);
        } else {
            insert(dp, m, r, a);
        }
    }
}

fn l(dp: &Vec<i32>) -> usize {
    let mut ans = 0;
    for i in 0..dp.len() {
        if dp[i] == 1000000001 {
            ans = i - 1;
            break;
        }
    }
    ans
}

fn main() {
    let n: usize = read();
    let a: Vec<i32> = read_col(n);
    let mut dp: Vec<i32> = vec![1000000001; n + 2];
    dp[0] = -1;

    for i in 0..n {
        insert(&mut dp, 0, n + 1, a[i]);
    }

    println!("{}", l(&dp));
}



Measured memory_bytes: 5052
#include <iostream>
#include <cmath>

int main(int argc, const char *argv[]) {
    static const double pi = 3.141592653589793;
    int a, b, c;
    std::cin >> a >> b >> c;
    double s = 0.5 * a * b * std::sin(pi * c / 180);
    double l = a + b + std::sqrt(std::pow(a, 2.0) + std::pow(b, 2.0) - 2.0 * a * b * std::cos(pi * c / 180));
    double h = b * std::sin(pi * c / 180);
    std::cout << std::fixed << s << std::endl;
    std::cout << std::fixed << l << std::endl;
    std::cout << std::fixed << h << std::endl;
    return 0;
}

Measured memory_bytes: 3588
//Littleboy123 Template 1.1

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

//pragmas
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
*/

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll, ll> lll;

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define COUT(a) cout << (a) << '\n'
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)

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

//End of template

int main(){
	init();

	//debug
	/*
	ifstream in("input.in");
	streambuf *cinbuf = std::cin.rdbuf();
	cin.rdbuf(in.rdbuf());

	
	ofstream out("out.txt");
	streambuf *coutbuf = std::cout.rdbuf();
	cout.rdbuf(out.rdbuf());
	*/
	//end debug

	int n;
	cin >> n;
	ld arr[n];
	FOR(i, 0, n){
		cin >> arr[i];
	}
	sort(arr, arr+n);
	ld val = arr[0];
	FOR(i, 1, n){
		val = (val+arr[i])/2;
	}
	cout << fixed << setprecision(9) << val << nl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int pay = sc.nextInt();
		int maypay = (int) (pay / 1.1);
		boolean flg = true;
		while(flg){
			if(Math.floor(maypay * 1.08) == pay){
				System.out.println(maypay);
				flg = false;
			}else{
				maypay ++;
			}
			if(maypay > pay){
				System.out.println(":(");
				flg = false;
			}
		}
	}
}




Measured memory_bytes: 35772
n=gets.to_i
if n==1
    p 1
    exit
end
points=[*1..n]
s=[]
s[0]=0
result=[]
for i in 0..points.length-1
    s[i+1]=s[i]+points[i]
    if s[i+1]<n
        result<<points[i]
    end
end

result<<result[-1]+1

v=s[result.length]-n

result.delete(v)
puts result

Measured memory_bytes: 248800
/* AOJ 0079
 *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0079
 *
 */

#include <stdio.h>
#include <math.h>

typedef struct TPoint Point;
struct TPoint {
    double fX;
    double fY;
};

Point V[20];

double heron(double a, double b, double c){
    double z;
    z = (a+b+c)/2;
    return sqrt(z*(z-a)*(z-b)*(z-c));
}

double distance(Point a, Point b){
    return sqrt((a.fX-b.fX)*(a.fX-b.fX)+(a.fY-b.fY)*(a.fY-b.fY));
}

int main(){
    float x, y;
    int i, n;
    double S;

    n = 0;
    while(scanf("%f,%f", &x, &y)==2){
        V[n].fX = x;
        V[n].fY = y;
        n++;
    }

    S = 0.0;
    for(i=1; i<n-1;i++){
        S += heron(
                distance(V[0], V[i]),
                distance(V[0], V[i+1]),
                distance(V[i], V[i+1]));
    }
    printf("%f\n",S);

    return 0;
}

Measured memory_bytes: 0
n = int(input())
tmp = input().split()
a = []
for i in range(n):
  a.append(int(tmp[i]))

a.sort()

for i in range(n-1):
  x = a[i]
  y = a[i+1]
  if(x == y):
    print("NO")
    exit()

print("YES")

Measured memory_bytes: 31644
"""from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd"""
N,K=map(int,input().split())

#A=[list(reversed(list(map(int,input().split())))) for i in range(N)]
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
fac=[1,1]
for i in range(2,N+1):
    fac.append(fac[i-1]*i%mod)
ifac=[pow(i,mod-2,mod) for i in fac]


if K==1:
    print(0)
    exit()


count=0
ncount=0
for i in range(N-K+1):
    n=N-i-K
    m=i+K-2
    ncount+=fac[m]*ifac[K-2]*ifac[m-(K-2)]%mod
    ncount%=mod
    count-=A[n]*ncount
    count%=mod

ncount=0
for i in range(K-1,N):
    n=i-1
    ncount+=fac[n]*ifac[K-2]*ifac[n-(K-2)]%mod
    ncount%=mod
    count+=A[i]*ncount
    count%=mod
print(count)


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

const int maxn = 2e5 + 10;
int par1[maxn], par2[maxn];
map<pair<int, int>, int> same;

void init(int n) {
	for (int i = 1; i <= n; i++) {
		par1[i] = par2[i] = i;
	}
}

int find1(int x) {
	if (x == par1[x]) {
		return par1[x];
	} else {
		return par1[x] = find1(par1[x]);
	}
}

int find2(int x) {
	if (x == par2[x]) {
		return par2[x];
	} else {
		return par2[x] = find2(par2[x]);
	}
}

void unite1(int x, int y) {
	x = find1(x);
	y = find1(y);
	par1[x] = y;
}

void unite2(int x, int y) {
	x = find2(x);
	y = find2(y);
	par2[x] = y;
}

int main() {
	ios::sync_with_stdio(false);
	int n, k, l;
	cin >> n >> k >> l;
	init(n);
	while (k--) {
		int u, v;
		cin >> u >> v;
		unite1(u, v);
	}
	while (l--) {
		int u, v;
		cin >> u >> v;
		unite2(u, v);
	}
	for (int i = 1; i <= n; i++) {
		int u = find1(i), v = find2(i);
		same[make_pair(u, v)]++;
	}
	for (int i = 1; i <= n; i++) {
		int u = find1(i), v = find2(i);
		cout << same[make_pair(u, v)] << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 13568
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed parsing")
}

use std::cmp::{min};

fn main() {
    
    let n = read::<usize>();
    let a = read::<usize>();
    let b = read::<usize>();
    
    println!("{}", min(n * a, b));
    
}

Measured memory_bytes: 4352
using System;

namespace ABC125
{
    class Program
    {
        static int Main(string[] args)
        {
            string[] input = System.Console.ReadLine().Split(' ');

            int a, b, t;
            a = int.Parse(input[0]);
            b = int.Parse(input[1]);
            t = int.Parse(input[2]);

            System.Console.WriteLine((t / a) * b);

            return 0;
        }
    }
}

Measured memory_bytes: 13140
//go:generate echo "https://atcoder.jp/contests/abc173/tasks/abc173_a"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) Ints(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func solve(N int) int {
	return (1000 - N%1000) % 1000
}

func run(r io.Reader, w io.Writer) {
	scan := newScanner(r)
	fmt.Fprintln(w, solve(scan.Int()))
}

func main() {
	run(os.Stdin, os.Stdout)
}


Measured memory_bytes: 1776
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
 	long long n,W;
  cin>>n>>W;
  long long w[n+1],v[n+1];
  for(long long i=1; i<=n; i++)
  {
   	cin>>w[i]>>v[i]; 
  }
  long long mat[n+1][W+1];
  memset(mat,0,sizeof(mat));
  for(long long i=1; i<=n; i++)
  {
   	for(long long j=0; j<=W; j++)
    {
     	if(!i || !j)
        {
         	mat[i][j]=0; 
        }
      else if(j<w[i])
      {
       	mat[i][j]=mat[i-1][j]; 
      }
      else
      {
       	mat[i][j]=max(mat[i-1][j],v[i]+mat[i-1][j-w[i]]);
      }
    }
  }
  cout<<mat[n][W]<<endl;
  return 0;
}

Measured memory_bytes: 79104
fun main() {
    val n = readLine()!!.toInt()

    val sMap = HashMap<String, Int>()
    for (i in 0 until n) {
        val s = readLine()!!

        sMap[s] = (sMap[s] ?: 0) + 1
    }
    sMap["AC"] = sMap["AC"] ?: 0
    sMap["WA"] = sMap["WA"] ?: 0
    sMap["TLE"] = sMap["TLE"] ?: 0
    sMap["RE"] = sMap["RE"] ?: 0

    println("AC x " + sMap["AC"])
    println("WA x " + sMap["WA"])
    println("TLE x " + sMap["TLE"])
    println("RE x " + sMap["RE"])
}

Measured memory_bytes: 57684
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	vector<int> v(5);
	int k;
	for(int i = 0; i < 5; i++) cin >> v[i];
	cin >> k;
	for(int i = 0; i < 5; i++) {
		for(int j = i + 1; j < 5; j++) {
			if(abs(v[i]-v[j])>k) {
				cout << ":(";
				exit(0);
			}
		}
	}
	cout << "Yay!";
	return 0;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] arr = new int[3];
		arr[0] = sc.nextInt();
		arr[1] = sc.nextInt();
		arr[2] = sc.nextInt();
		Arrays.sort(arr);
		System.out.println(arr[2]*10 + arr[0] + arr[1]);
				
			
		
	}

}


Measured memory_bytes: 35332
n = int(input())
s = 0
m = 1
while m * m <= n:
    if n % m == 0:
        num1 = m - 1
        if num1 and n // num1 == n % num1:
            s += num1
        num2 = n // m - 1
        if num1 != num2 and num2 and n // num2 == n % num2:
            s += num2
    m += 1
print(s)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

bool judge(int num)
{
	if (num < 2)	return (false);
	if (num == 2)	return (true);
	if (num % 2 == 0)	return (false);
	for (int i = 3; i * i <= num; i += 2){
		if (num % i == 0)	return (false);
	}
	return (true);
}

int main()
{
	int n, num;
	int ct = 0;
	
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> num;
		if (judge(num))	ct++;
	}
	
	cout << ct << endl;
	return (0);
}

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

int main() {
  int A,B,C,D,L,R;
  cin >>A  >>B >>C >>D;
  
  L=A+B;
  R=C+D;
  
  if(L>R)
    cout << "Left" << endl;
  
  else if(L==R)
    cout << "Balanced" << endl;
  
  else
    cout << "Right" << endl;
  
}

Measured memory_bytes: 3628
//#define TEST

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int>> s(N);
	for (int i = 0; i < N; i++) {
		s[i] = make_pair(0, 0);
		cin >> s[i].first >> s[i].second;
	}
	sort(s.begin(), s.end());
#ifdef TEST
	for (int i = 0; i < N; i++)
		cout << s[i].first << " " << s[i].second << endl;
#endif
	long cost = 0;
	for (int i = 0; i < N; i++) {
		if (M > s[i].second) {
			M -= s[i].second;
			cost += static_cast<long>(s[i].first) * s[i].second;
		}
		else {
			cost += static_cast<long>(s[i].first) * M;
			M = 0;
		}
		if (M == 0) break;
	}
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main()
{
    int n;
    cin >> n;
    int k = n%10;
    if(k == 2 || k == 4 || k == 5 || k == 7 || k == 9){
        cout << "hon";
        return 0;
    }
    if(k == 0 || k == 1 || k == 6 || k == 8){
        cout << "pon";
        return 0;
    }
    if(k == 3){
        cout << "bon";
        return 0;
    }

}


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

using namespace std;

typedef long long ll;

int n, m;
vector<string> a;
vector<string> b;

bool check(int r, int c){
	for(int i = r; i < r + m; i++){
		for(int j = c; j < c + m; j++){
			if(a[i][j] != b[i-r][j-c]) return false;
		}
	}

	return true;
}

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

	cin >> n >> m;

	a.resize(n);
	rep(i, n) cin >> a[i];

	b.resize(m);
	rep(i, m) cin >> b[i];

	for(int r = 0; r + m - 1 < n; r++){
		for(int c = 0; c + m - 1 < n; c++){
			if(check(r, c)){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,j,N,H,W,ans=0;
  cin>>N;
  string s;
  map<string,ll> mp;
  rep(i,N){
	  cin>>s;
	  chmax(ans,++mp[s]);
  }
  for(auto x:mp){
	  if(x.second==ans)print(x.first);
  }
  return 0;
}

Measured memory_bytes: 25216
#include <iostream>

using namespace std;

int main() {
    int N, M, P, X[101];
    while (cin >> N >> M >> P) {
        if (N == 0 && M == 0 & P == 0) { break; }

        int ans = 0;

        for (int i = 0; i < N; i++) {
            cin >> X[i];
            ans += X[i];
        }
        cout << (X[M-1] == 0 ? 0 : ans * (100-P) / X[M-1]) << endl;
    }
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int x, y;
  cin >> x >> y;
  if(x % y == 0) {
    cout << -1 << endl;
  }else cout << x << endl;

}


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

int main(){
    ll a,v,b,w,t;
    cin >>a>>v>>b>>w>>t;
    if(abs(a-b) <= (v-w)*t){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" <<endl;
    }
}


Measured memory_bytes: 3588
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif
 
using namespace std;
 
 
int main(){
    int n,ans=1;
    cin >> n;

    for(int i=0;i<7;i++){
        if(n<ans*2 && n>=ans)
            break;
        ans *=2;
    }

    //cout << (flag ? "Yes" : "No") << endl;
    cout << ans << endl;
 
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

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

int main(){
    int N, M; cin >> N >> M;
    vi A(M), B(M);
    vii G(N);
    for(int i=0; i<M; i++){
        cin >> A[i] >> B[i];
        A[i]--, B[i]--;
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    int ans=0;
    vector<bool> seen(N, 0);
    for(int i=0; i<N; i++){
        if(seen[i]) continue;
        queue<int> que;
        que.push(i);
        seen[i]=true;
        int size=0;
        while(!que.empty()){
            int v=que.front();
            que.pop();
            size++;
            for(auto nv : G[v]){
                if(seen[nv]) continue;
                seen[nv]=true;
                que.push(nv);
            }
        }
        chmax(ans, size);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16236
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  string S;
  cin >> S;
  unordered_map<char, int> cs;
  int result = 0;
  F0R(i, S.size()) {
    if (++cs[S[i]] == 2) result++;
  }
  cout << (result == 2 ? "Yes" : "No");
}
#endif


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int cnt=0;
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
      }else{
        cnt=1;
      }
    }
    if(i%2!=0){
      if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
      }else{
        cnt=1;
      }
    }
  }
  if(cnt==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

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

ans, C, MOD = 1, [-1, -1, -1], 1000000007
for a in A:
    match = sum([1 for c in C if c + 1 == a])
    if match == 0:
        print(0)
        exit()
    else:
        ans = (ans * match) % MOD
        for i in (0, 1, 2):
            if C[i] + 1 == a:
                C[i] += 1
                break

print(ans)


Measured memory_bytes: 53080
///                ..:: In The Name Of God ::..
#include<bits/stdc++.h>

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define error(x) cerr << #x << " = " << (x) << endl;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Size(x) (int)(x).size()
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    
    int x, a;
    cin >> x >> a;
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;
    
    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()
t=""
k=""
ans=0
l=[]
for i in range(1,n):
    ans1=0
    t=sorted(set(s[:i]))
    k=sorted(set(s[i:]))
    for i in t:
        for j in k:
            if i==j:
                ans1+=1
            l.append(ans1)
print(max(l))

Measured memory_bytes: 3480