akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	int mi =INT_MIN;
	int ma = INT_MAX;
	int l,r;
	for(int i =0; i < m; i++){
		cin>>l>>r;
		mi = max(mi, l);
		ma = min(ma, r);
	}
	int val = max(0, (ma-mi)+1);
	cout<<val;
	return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


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

    int ans = inf;
    rep(i,0,sz(s)-2){
	string t = s.substr(i,3);
	ans = min(ans,abs(753  - stoi(t)));
    }
    P(ans);
    return  0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    ll a[10];
    rep(i,3) cin>>a[i];
    sort(a,a+3);
    cout<<a[0]+a[1]<<endl;

}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){

        solve();

    }
   


    return 0;
}


Measured memory_bytes: 256
namespace Test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class Test
    {
        public static void Main(string[] args)
        {
            var t = new Test();
            var s = int.Parse(Console.ReadLine());
            var h = s / 3600;
            var m = (s % 3600) / 60;
            var ss = s % 60;

            Console.WriteLine(h + ":" + m + ":" + ss);
        }
}
}



Measured memory_bytes: 15988
n = int(raw_input())
pts = [map(int, raw_input().split()) for i in xrange(n)]

for i in xrange(105):
    for j in xrange(105):
        H = 0
        ok = True
        for k in pts:
            if max(H - abs(k[0] - i) - abs(k[1] - j), 0) == k[2]:
                continue
            elif H < 1:
                H = k[2] + abs(k[0] - i) + abs(k[1] - j)
            else:
                ok = False
        if ok and H > 0:

            for k in pts:
                if max(H - abs(k[0] - i) - abs(k[1] - j), 0) == k[2]:
                    continue
                else:
                    ok = False

            if ok:
                print i, j, H
                exit(0)

Measured memory_bytes: 33004
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double INF = 1e12;
#define PI 2*acos(0.0)
typedef complex<double> P;
namespace std { bool operator < (const P& a, const P& b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); } }
namespace std { bool operator == (const P& a, const P& b) { return abs(real(a) - real(b)) < EPS && abs(imag(a) - imag(b)) < EPS; } }
double cross(const P& a, const P& b) { return imag(conj(a)*b); }
double dot(const P& a, const P& b) { return real(conj(a)*b); }
struct L : public vector<P> { L() {} L(const P &a, const P &b) { push_back(a); push_back(b); } };
typedef vector<P> G;
struct C { P p; double r; C() {} C(const P &p, double r) : p(p), r(r) {} };
int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if (cross(b, c) > 0)   return +1;       // counter clockwise
	if (cross(b, c) < 0)   return -1;       // clockwise
	if (dot(b, c) < 0)     return +2;       // c--a--b on line
	if (norm(b) < norm(c)) return -2;       // a--b--c on line
	return 0;
}
/*---------------------------------------------------------------------------------------------------
????????????????????????????????? ??§?????§  
??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!
???????????? ??? ?´_???`??????/??? ???i     
?????????????????????????????? ???  |???|     
????????? /?????? /??£??£??£??£/??????|  
??? ???_(__??????/???    ???/ .| .|????????????  
??? ????????????/????????????/??????u??????  
---------------------------------------------------------------------------------------------------*/






//---------------------------------------------------------------------------------------------------
void _main() {
    double a, b, c, d, e, f, g, h;
    while (~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &a, &b, &c, &d, &e, &f, &g, &h)) {
        vector<P> v;
        v.push_back(P(a, b));
        v.push_back(P(c, d));
        v.push_back(P(e, f));
        v.push_back(P(g, h));

        set<int> s;
        rep(i, 0, 4) {
            int j = (i + 1) % 4;
            int k = (i + 2) % 4;

            s.insert(ccw(v[i], v[j], v[k]));
        }

        if (s.size() == 1) printf("YES\n");
        else printf("NO\n");
    }
}

Measured memory_bytes: 3136
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		x = (int) Math.pow(x, 3);
		System.out.println(x);

		sc.close();
	}
}


Measured memory_bytes: 26200
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
 
    void solve(){
        int n,m;
        cin>>n>>m;
        vector<int>vis(n,0);
        int acc=0,pen=0;
        vector<int>s(n,0);
        for(int i=0;i<m;i++){
            int num;
            cin>>num;
            --num;
            string str;
            cin>>str;
            if(str=="WA"){
                if(vis[num]==0)
                    s[num]++;
            }   
            else{
                if(vis[num]==0){
                    vis[num]=1;
                }
            }
        }
        for(int i=0;i<n;i++){
            if(vis[i]){
                acc++;
                pen+=s[i];
            }
        }
        cout<<acc<<" "<<pen;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 3972
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}




template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WG = vector< Edges< T > >;
using UG = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;


template< typename T >
vector< T > bellman_ford(Edges< T > &edges, int V, int s) {
  //const auto INF = numeric_limits< T >::max();
  vector< T > dist(V, INF);
  dist[s] = 0;
  for(int i = 0; i < V - 1; i++) {
    for(auto &e : edges) {
      if(dist[e.src] == INF) continue;
      dist[e.to] = min(dist[e.to], dist[e.src] + e.cost);
    }
  }
  for(auto &e : edges) {
    if(dist[e.src] == INF) continue;
    if(dist[e.src] + e.cost < dist[e.to]) return vector< T >();
  }
  return dist;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n,m,s;
  cin>>n>>m>>s;
  Edges<int> es;
  rep(i,m){
    int a,b,c;
    cin>>a>>b>>c;
    es.PB(edge<int>(a,b,c));
  }

  vi res=bellman_ford(es,n,s);

  if(res.empty()){
    cout<<"NEGATIVE CYCLE"<<endl;
  }else{
    for(int x:res){
      if(x==INF){
        cout<<"INF"<<endl;
      }else{
        cout<<x<<endl;
      }
    }
  }


}


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

int main(){

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

    long long int a, b, c, d;
    cin >> a >> b >> c >> d;

    long long int x = a*c;
    long long int y = a*d;
    long long int z = b*c;
    long long int t = b*d;
    cout<<max(x,max(y,max(z,t)));

    return 0;
}


Measured memory_bytes: 3648
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var A = sc.next();
        var B = sc.next();
        var C = sc.next();

        var card = A[0];
        var ai = A.Length - 1;
        var bi = B.Length;
        var ci = C.Length;
        while (true) {
            if (card == 'a') {
                if (ai == 0) {
                    WriteLine("A");
                    return;
                }
                card = A[A.Length-ai];
                ai--;
            } else if (card == 'b') {
                if (bi == 0) {
                    WriteLine("B");
                    return;
                }
                card = B[B.Length-bi];
                bi--;
                
            } else {
                if (ci == 0) {
                    WriteLine("C");
                    return;
                }
                card = C[C.Length-ci];
                ci--;
                
            }
        }
    }
    
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

int depth[1000] = { 0 };
std::string s[1000];

int main() {
	int n;
	while (std::cin >> n && n) {
		int lastDepth = 0;
		for (int i = 0; i < n; i++) {
			std::string ss; std::cin >> ss;
			int p = 0;
			if (i) {
				p = ss.find_last_of('.');
				p++;
				depth[i] = p;
			}
			s[i] = ss.substr(p);
		}

		bool isThereReplay[1001] = {false};
		for (int i = 0; i < n; i++) {
			isThereReplay[depth[i]] = false;//??´??\??????????????????

			// | ?????????
			for (int j = 1; j < depth[i] && i; j++) {
				if (isThereReplay[j]) std::cout << "|";
				else std::cout << " ";
			}
			if (i) std::cout << "+";
			std::cout << s[i] << std::endl;

			//??????????¨???????????????´??\?????????????????????????????????
			for (int j = i + 1; j < n; j++) {
				if (j == i + 1 && depth[i] >= depth[j]) break; //??????
				else if (depth[i] > depth[j]) break; //??????
				else if (depth[i] == depth[j]) { //??????
					isThereReplay[depth[i]] = true;
				}
			}
		}
	}

	return 0;
}

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

int main(void)
{
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0) {
        cout << (a+b)/2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n:usize = read();
    let mut map = HashMap::new();
    for _ in 0..n {
        let x:u64 = read();
        *map.entry(x).or_insert(0u64) += 1u64;
    }
    let mut ans = 0;
    for (k, i) in map {
        if k > i {
            ans += i;
        } else {
            ans += (i - k);
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 5428
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    int a, p;
    cin >> a >> p;
    cout << (p + a * 3) / 2;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG arc/arc069/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    ll N, M;
    cin >> N >> M;

    if(2 * N >= M){
        cout << M / 2 << "\n";
    }else{
        cout << N + (M - 2 * N)/4 << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    }
}


Measured memory_bytes: 21844
#include<stdio.h>

int main (void){

    long long a,b,c,k,sum=0;

    scanf("%lld %lld %lld %lld",&a,&b,&c,&k);

    if(k<=a){
        sum+=k;
        printf("%lld",sum);
    }else{
        sum+=a;
        k-=a;
        if(k<=b){
            printf("%lld",sum);
        }else{
            k-=b;
            sum-=k;
            printf("%lld",sum);
        }
    }


    return 0;
}

Measured memory_bytes: 1704
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

    string s, t;
    cin >> s >> t;
    int len = s.size();
    vector<int> s_cnt('z' - 'a' + 1);
    rep(i,'z' - 'a' + 1) s_cnt[i] = 0;
    vector<int> t_cnt('z' - 'a' + 1);
    rep(i,'z' - 'a' + 1) t_cnt[i] = 0;
    rep(i,len) {
        ++s_cnt[s[i] - 'a'];
        ++t_cnt[t[i] - 'a'];
    }
    Sort(s_cnt);
    Sort(t_cnt);
    bool flag = true;
    rep(i,'z' - 'a' + 1) {
        if (s_cnt[i] != t_cnt[i]) flag = false;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}






Measured memory_bytes: 1020
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 to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let n = read::<i64>();
  let mut red = vec![];
  let mut blue = vec![];
  let mut ans = 0;

  for _ in 0..n {
    let a = read::<i64>();
    let b = read::<i64>();
    red.push(vec![a, b])
  }
  for _ in 0..n {
    let a = read::<i64>();
    let b = read::<i64>();
    blue.push(vec![a, b])
  }

  blue.sort_by_key(|x| x[0]);
  red.sort_by_key(|x| -x[1]);

  for (i, v) in blue.iter().enumerate() {
    // let mut dib = i;
    let mut dir = -1 as i64;
    for (ii, iv) in red.iter().enumerate() {
      if iv[1] < v[1] && iv[0] < v[0] {
        dir = ii as i64;
        ans += 1;
        break;
      }
    }
    if dir != -1 {
      red.remove(dir as usize);
    }
  }

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, n) for (int i = 0; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];
    sort(all(A));
    cout << (A[1] - A[0]) + (A[2]-A[1]) << endl; 
}

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

long long n, q;
vector<long long> edge[200005], ans;
vector<bool> used;
queue<long long> qu;

void solve();

int main() {
  cin >> n >> q;
  used.resize(n, 0);
  ans.resize(n, 0);
  for(int i = 0; i < n - 1; ++i) {
    long long a, b;
    cin >> a >> b;
    --a, --b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for(int i = 0; i < q; ++i) {
    long long p, x;
    cin >> p >> x;
    ans[--p] += x;
  }
  solve();
  for(int i = 0; i < n; ++i) {
    if(i != 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

void solve() {
  qu.push(0);
  while(!qu.empty()) {
    long long now = qu.front();
    qu.pop();
    used[0] = 1;
    for(int i = 0; i < (int)edge[now].size(); ++i)
      if(!used[edge[now][i]]) {
        long long nextp = edge[now][i];
        used[nextp] = 1;
        ans[nextp] += ans[now];
        qu.push(nextp);
      }
  }
}

Measured memory_bytes: 17904
def readInt():
    return int(input())
def readList():
    return list(map(int,input().split()))
def readMap():
	return map(int,input().split())
def readStr():
    return input()
inf=float('inf')
mod = 10**9+7
import math
def solve(s):
    return s+'s' if s[-1]!='s' else s+'es'


s=readStr()
print(solve(s))

Measured memory_bytes: 9116
#include <stdio.h>

#define NUMBER 200000

int main(void)
{
	int i,n;
	long  a;
	long max = -1000000;
	long min = 1000000;
	long sum = 0;
	scanf ("%d",&n);
	for (i = 0; i < n; i++){
		scanf ("%ld",&a);
		if (min > a) min = a;
		if (max < a) max = a;
		sum += a;
	}
	printf ("%ld %ld %ld\n",min,max,sum);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <algorithm>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;
int n,m;
string s[1001];
bool isValid(int x,int y)
{
    if(x<0|| x>n-1 || y<0 || y>m-1)return 0;
    if(s[x][y]=='#')return 0;
    return 1;
}
void solve()
{
  
   cin>>n>>m;
   int s1,s2;
   cin>>s1>>s2;

   int d1,d2;
   cin>>d1>>d2;
   s1--,s2--,d1--,d2--;
  
   fr(i,n)
   {
       cin>>s[i];
   }
   int dis[n][m];
   fr(i,n)
   {
       fr(j,m)
       {
           dis[i][j]=1e7;
       }
   }
   dis[s1][s2]=0;
   int dx[]={-1,0,0,1};
    int dy[]={0,1,-1,0};
   deque<int>qx,qy;
   qx.push_front(s1);
   qy.push_front(s2);
   while(!qx.empty())
   {
       int curx=qx.front(),cury=qy.front();
        qx.pop_front(),qy.pop_front();
        
        fr(i,4)
        {
            int newx=curx+dx[i],newy=cury+dy[i];
            //  cout<<newx<<newy<<isValid(newx,newy)<<" ";
            if(!isValid(newx,newy))continue;
           
            if(dis[newx][newy]>dis[curx][cury])
            {dis[newx][newy]=dis[curx][cury];
             
            qx.push_front(newx),qy.push_front(newy);
            }
        }
        frf(i,curx-2,curx+2)
        {
            frf(j,cury-2,cury+2)
            {
                if(!isValid(i,j))continue;
                if(dis[i][j]>dis[curx][cury]+1)
                { 
                    dis[i][j]=dis[curx][cury]+1;
                    qx.push_back(i),qy.push_back(j);
                }
                
            }
        }
   }
   if(dis[d1][d2]==1e7)
   {
       cout<<-1;
   }
   else
   {
       cout<<dis[d1][d2];
   }

// fr(i,n)
// {
//     fr(j,m)
//     {
//         cout<<dis[i][j]<<" ";
//     }
//     cout<<"\n";
// }
}
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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


Measured memory_bytes: 12628
// B-Great Ocean View.cpp : アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include<iostream>
#include<string>
#include<vector>

using namespace std;


int main()
{
    int N;	
	cin >> N;
	vector<int> H;

	int l;
	for (int i = 0; i < N;i++) {
		cin >> l;
		H.push_back(l);
	}

	int counter = 1;
	int max = H[0];

	for (int i = 1; i < N; i++) {
		if (H[i] >= max) {
			counter++;
			max = H[i];
		}
	}
	cout << counter;

	
	//cin>>N;

    return 0;
}



Measured memory_bytes: 256
N = int(input())
count, A, B, BA = 0, 0, 0, 0
for _ in range(N):
    s = input()
    count += s.count('AB')
    B += s[0] == 'B'
    A += s[-1] == 'A'
    BA += s[0] == 'B' and s[-1] == 'A'
    #print(s, A,B,BA, 'count', count)
tmp = (A - 1) if (A == B and A == BA and BA != 0) else min(A,B)
print(count + tmp)


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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] abc = new int[3];

		abc[0] = sc.nextInt();
		abc[1] = sc.nextInt();
		abc[2] = sc.nextInt();

		Arrays.sort(abc);

		StringBuilder x = new StringBuilder();

		for (int i = 0; i < abc.length; i++) {
			x.append(abc[i]);
			if (i < abc.length - 1) {
				x.append(" ");
			}
		}

		String y = x.toString();
		System.out.println(y);

	}

}



Measured memory_bytes: 26228
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
using namespace std;
typedef long long ll;

int main(){
    int h,w,n; cin>>h>>w>>n;
    for(int i=1;;i++){
        if(h*i>=n||w*i>=n){
            cout<<i<<endl;
            return 0;
        }
    }
}

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

using namespace std;

const int MAXN = 100005;
const int MOD = 1000000007;

int calc(int n, int x[]) {
    int res = 0;
    for(int i = 1; i < n; ++i) {
        int cnt = (1LL * i * (n-i)) % MOD;
        res = (res + 1LL * cnt * (x[i] - x[i-1])) % MOD;
    }
    return res;
}

int n, m, x[MAXN], y[MAXN];

int main() {
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; ++i)
        scanf("%d", &x[i]);
    for(int i = 0; i < m; ++i)
        scanf("%d", &y[i]);

    int sumX = calc(n, x);
    int sumY = calc(m, y);
    int ans = (1LL * sumX * sumY) % MOD;

    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
using namespace std;
string a;
int ans=0;
int main(){
	cin>>a;
	for(int i=0;i<=a.size();i++){
		if(a[i]=='C')ans=1;
		if(a[i]=='F'&&ans==1){
		cout<<"Yes"<<endl;
		return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

const int maxn=1e5+1e2;
int n,m;
char a[maxn],b[maxn];

inline void file() {
	freopen("AGC028A.in","r",stdin);
	freopen("AGC028A.out","w",stdout);
}

inline int read() {
	int x=0,p=1;
	char c=getchar();
	while (!isdigit(c)) { if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) { x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	return x*p;
}

int main() {
//	file();
	n=read(); m=read();
	scanf("%s",a+1); scanf("%s",b+1);
	ll L=1ll*n*m/__gcd(n,m);
	int L1=L/n,L2=L/m;
	swap(L1,L2);
	int p1=1,p2=1;
	while (p1<=n && p2<=m) {
		if (a[p1]!=b[p2]) {
			puts("-1"); return 0;
		}
		p1+=L1; p2+=L2;
	}
	printf("%lld\n",L);
	return 0;
}

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

int main() {
  int N , N_1 , N_2 , N_3 , N_4;
  cin >> N;
  
  N_1 = N / 1000;
  N_2 = (N - N_1*1000)/100;
  N_3 = (N - N_1*1000 - N_2*100)/10;
  N_4 = N - N_1*1000 - N_2*100 - N_3*10;
  
  if (N_1 == N_2 && N_2 == N_3 && N_3 == N_4){
    cout << "Yes" << endl;
  }
  
  else if (N_1 == N_2 && N_2 == N_3){
    cout << "Yes" << endl;
  }
  
  else if (N_2 == N_3 && N_3 == N_4){
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<limits>

using namespace std;

int x[100000];
pair<int, int> cb[100000];

int main(){
  int n, m; cin >> n >> m;
  long long ans = 0;

  for(int i=0; i<n; ++i){
    cin >> x[i];
    ans += x[i];
  }
  sort(x, x + n);

  for(int i=0; i<m; ++i) cin >> cb[i].second >> cb[i].first;
  sort(cb,  cb + m, greater<pair<int, int>>());

  int i=0, l=0;
  while(cb[i].first > x[l] && l < n && i < m){
    ans += cb[i].first - x[l];
    ++l;
    if(--(cb[i].second) == 0) ++i;
  }

  cout << ans << endl;
}



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

int main(){
	int n;cin >> n;
	float a[8];
	float x1, x2, y1, y2, ans;
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		y1 = a[3]-a[1];x1 = a[2]-a[0];
		y2 = a[7]-a[5];x2 = a[6]-a[4];
		ans = y1*x2-y2*x1;
		if(ans == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

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

using namespace std;
#define sz(a) (int)a.size()
#define int int64_t
template<typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
     out << "{" << p.first << ", " << p.second << "} ";//optional
     return out;
}

template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
     in >> p.first >> p.second;
     return in;
}

template<typename T>
istream &operator>>(istream &in, vector<T> &arr) {
     for (auto &i : arr)
          in >> i;
     return in;
}

template<typename T>
ostream &operator<<(ostream &out, vector<T> &arr) {
     for (int i = 0; i < (int)arr.size(); ++i) {
          if (i != 0) {
               out << ' ';
          }
          out << arr[i];//optional
     }
     out << endl;
     return out;
}


signed main() {
     int h, w;
     cin >> h >> w;;
     int n;
     cin >> n;
     vector<int> a(n);
     vector<vector<int>> color(h, vector<int>(w));
     cin >> a;
     int row = 0, col = 0;
     int dir = 1;
     for (int i = 0; i < n; ++i) {
          int el = a[i];
          while (el) {
               color[row][col] = i + 1;
               if (col == w - 1 && dir == 1) {
                    row++;
                    dir = -dir;
               }
               else if (col == 0 && dir == -1) {
                    row++;
                    dir = -dir;
               } else {
                    col += dir;
               }
               el--;
          }
     }
     for (auto el : color) {
          for (auto ell : el) {
               cout << ell << ' ';
          }
          cout << endl;
     }
     return 0;
}


Measured memory_bytes: 512
n = int(input())
w_lst = list(map(int,input().split()))

ans = float("inf")

for i in range(len(w_lst)):
    if abs(sum(w_lst[0:i]) - sum(w_lst[i:])) < ans:
        ans = abs(sum(w_lst[0:i]) - sum(w_lst[i:])) 

print(ans)

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

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

    vector<int> N(A);
    for (int i = 0; i < B; i++) {
        int a, b;
        cin >> a >> b;
        N.at(a - 1)++;
        N.at(b - 1)++;
    }
    
    for (int i = 0; i < N.size(); i++) {
        cout << N.at(i) << endl;
    }
}

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

value = 0
value2 = 0

for i in range(N):
    for j in range(N):
        value = value + d[i]*d[j]
        
for i in range(N):
    value2 = value2 + d[i]*d[i]
    
print(int((value-value2)/2))

Measured memory_bytes: 3064
<?php
    $tmp = explode(" ", trim(fgets(STDIN)));
    $w = $tmp[0];
    $h = $tmp[1];
    $x = $tmp[2];
    $y = $tmp[3];
    $r = $tmp[4];
    $msg = $x - $r < 0 || $x + $r > $w || $y - $r < 0 || $y + $r > $h ? "No\n" : "Yes\n";
    print($msg);
?>


Measured memory_bytes: 9220
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+";
    } else if (a * b == 15) {
        cout << "*";
    } else {
        cout << "x";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,d1,x;
int main(){
    cin>>n>>d1>>x;
    long double totd=(d1+x*(2*n-1)/2.0)*1LL*(n+1);
    long double ans=0;
    for(int i=1;i<=n;i++) ans+=totd/(long double)(n+2-i);
    printf("%.10lf\n",(double)ans);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solution sol = new Solution();
		sol.solve(in, out);
		out.close();
	}

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			long n=in.ni(), d=in.ni();
			long ans=0;
			for (int i=0; i<n; ++i) {
				long x=in.ni(), y=in.ni();
				if (((x * x) + (y * y)) <= (d * d)) ++ans;
			}
			out.println(ans);
		}
	}

	private static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		private String n() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		private int ni() {
			return Integer.parseInt(n());
		}
	}
}

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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  ll n;
  cin >> n;

  map<int, int> cnts;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    cnts[a]++;
  }

  if (n % 2 == 1 && cnts[0] > 1) {
    cout << 0 << '\n';
    return 0;
  }

  for (auto &p : cnts) {
    if (p.second > 2) {
      cout << 0 << '\n';
      return 0;
    }
  }

  ll md = 1e9 + 7;
  ll ans = 1;
  for (int i = 0; i < n / 2; ++i) {
    ans = ans * 2 % md;
  }

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

Measured memory_bytes: 6548
n=int(input())
a=[]
a=list(map(int,input().split()))
a.sort()
a.reverse()
alice=[]
bob=[]
for i in range (0,n):
    if i%2==0:
        alice.append(a[i])
    else :
        bob.append(a[i])
print(sum(alice)-sum(bob))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,a[102],k=0,l=0,cnt=0,x,n,m,c=200000000,b[102];
    int t;
    cin>>n>>t;
    for(i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(i=0;i<n;i++){
        if(b[i]<=t){c=min(c,a[i]);}
    }
    if(c==200000000){cout<<"TLE\n";}
    else{cout<<c<<endl;}



}



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

using namespace std;

int main()
{
  int n, ans;

  cin >> n;

  int i = 1;

  while (true)
  {
    ans = i * 111;
    if (n <= ans)
    {
      break;
    }
    i++;
  }

  cout << ans << endl;

  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
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; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
    ll n,m;
    cin >> n >> m;
    dsu uf(n);
    ll ans = n-1;
    rep(i,m){
        cin >> t1 >> t2;
        t1--,t2--;
        if(uf.same(t1,t2)){

        }else{
            ans--;
            uf.merge(t1,t2);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A, B; cin >> A >> B; 
	for(int i = 1; i <= 114514; i++){
		int p = i * 2 / 25; 
		int q = i / 10; 
		if(p == A && q == B){
			cout << i << endl; return 0; 
		}
	}
	cout << -1 << endl; 
}

Measured memory_bytes: 384
/* be name khoda */

#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

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

const ll maxn = 51;
const ll maxnlg = 20;

ll n, A[maxn], B[maxn], mask[maxn], dp[maxn][maxn];

void gen_dp() {
    fori (i, maxn) fori (j, maxn) dp[i][j] = i == j;
    forifrom (x, 1, maxn) {
        if (!mask[x]) continue;
        fori (i, maxn) {
            fori (j, i) {
                dp[i][j] |= dp[i % x][j];
            }
        }
    }
}

bool check() {
    gen_dp();
    fori (i, n) if (!dp[A[i]][B[i]]) return false;
    return true;
}

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

    cin >> n;
    fori (i, n) cin >> A[i];
    fori (i, n) cin >> B[i];

    fill(mask, mask + maxn, 1);
    if (!check()) {
        cout << "-1\n";
        return 0;
    }
    forir (i, maxn) {
        mask[i] = 0;
        if (!check()) mask[i] = 1;
    }
    ll ans = 0;
    fori (i, maxn) {
        if (mask[i]) ans += 1LL << i;
    }
    cout << ans << '\n';

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int n = sc.nextInt();
            int k = sc.nextInt();
            String s = sc.next();

            for (int i = 0; i < n; i++) {
                if (i + 1 == k) {
                    System.out.print(Character.toLowerCase(s.charAt(i)));
                } else {
                    System.out.print(s.charAt(i));
                }
            }


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 23124
s = str(raw_input())
q = int(raw_input())
for i in range(q):
    line = map(str, raw_input().split())
    com = line[0]
    a = int(line[1])
    b = int(line[2])
    if com == "print":
        print s[a:b+1]
    elif com == "reverse":
        tmp = s[::-1]
        s = s[:a] + tmp[len(tmp)-b-1:len(tmp)-a] + s[b+1:]
    elif com == "replace":
        p = line[3]
        s = s[:a] + p + s[b+1:]
    else:
        print "Error"



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

template <typename T>
T operator*(const vector<T> &a, const vector<T> &b)
{
    T total = 0;
    auto bi = b.begin();
    for(auto &x : a) 
        total += x * *bi++;
    return total;
}


int main()
{
    int n, m;
    cin >> n >> m;
    
    vector<vector<int>> mat(n, vector<int>(m));
    for(auto &row : mat)
        for(auto &elem : row)
            cin >> elem;

    vector<int> v(m);
    for(auto &elem : v)
        cin >> elem;

    for(auto &row : mat)
        cout << row * v << '\n';

    return 0;
}




Measured memory_bytes: 3184
#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#include <random>
#include <fstream>
#include <string>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <stack>

#define REP(i, N) for(int i = 0; i< N; i++)
using namespace std;
#define ll long long
const int INF = 1 << 29;
const ll llINF = 10000000000000000;

const int MOD = 1000000007;

#define MAX_N 100100
typedef pair<int, int> P;
typedef pair<ll, ll> llP;

int main(){
    int A, B;
    cin >> A >> B;
    printf("%d\n", (A - 1) * (B - 1));
    
}


Measured memory_bytes: 888