akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    string s;
    cin >> s;
    int n = sz(s);
    int gx, gy;
    cin >> gx >> gy;
    vector<int> x, y;
    for (int i = 0; i < n;) {
        int j = i;
        while (j < n && s[j] == 'F') j++;
        ((sz(x) + sz(y)) % 2 == 0 ? x : y).push_back(j - i);
        i = j + 1;
    }

    const int geta = 10000;
    gx += geta;
    gy += geta;
    auto dpx = make_vec<bool>(sz(x) + 10, 20000);
    rep(i, sz(x) + 10) rep(j, 20000) dpx[i][j] = 0;
    dpx[0][geta] = 1;
    rep(i, sz(x)) {
        rep(j, 20000) {
            if (j + x[i] < 20000 && dpx[i][j + x[i]]) {
                if (i == 0 && s[0] == 'F') continue;
                dpx[i + 1][j] = 1;
            }
            if (j - x[i] >= 0 && dpx[i][j - x[i]]) dpx[i + 1][j] = 1;
        }
    }
    auto dpy = make_vec<bool>(sz(y) + 10, 20000);
    rep(i, sz(y) + 10) rep(j, 20000) dpy[i][j] = 0;
    dpy[0][geta] = 1;
    rep(i, sz(y)) {
        rep(j, 20000) {
            if (j + y[i] < 20000 && dpy[i][j + y[i]]) dpy[i + 1][j] = 1;
            if (j - y[i] >= 0 && dpy[i][j - y[i]]) dpy[i + 1][j] = 1;
        }
    }
    cout << (dpx[sz(x)][gx] && dpy[sz(y)][gy] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 20096
#include <bits/stdc++.h>
 
using namespace std;
 
int dist(int from,int to){
        if (to<from) return from-to;
        int ans=0;
        if ((to-from)%2) from--,ans++;
        return ans+(to-from)/2;
}
int main(){
        int a[3];
        for(int i=0;i<3;i++) cin>>a[i];
        int ans=1000000;
        for(int i=-1000;i<=1000;i++){
                int cur=0;
                for(int j=0;j<3;j++) cur+=dist(a[j],i);
                ans=min(ans,cur);
        }
        cout<<ans;
}


Measured memory_bytes: 384
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def pf(s):
    print(s, flush=True)

def main():
    n,k = LI()
    t = [LI() for _ in range(n)]

    d = {}
    d[k] = 0
    j = 0
    for i in range(30,-1,-1):
        ii = 2**i
        if k & ii > 0:
            d[j+ii-1] = 0
            j += ii
    js = d.keys()
    for a,b in t:
        for j in js:
            if j & a ^ a == 0:
                d[j] += b
    return max(d.values())




print(main())






Measured memory_bytes: 23880
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cstring>
#include <bits/stdc++.h>
#include <search.h>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include<stack>
#include <utility>
using namespace std;
int main()
{
string s;
string arr[3]={"Sunny", "Cloudy","Rainy"};
cin>>s;
for(int i=0;i<3;i++){
    if(arr[i]==s){
        if(i+1<3) cout<<arr[i+1];
        else cout<<arr[0];
    }
}
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int binarySearch(int *, int, int);

int main(){
  int n, q, s[100000], t, a, count=0;

  scanf("%d",&n);
  for(a = 0; a < n; a++){
    scanf("%d",&s[a]);
  }
  scanf("%d",&q);
  for(a = 0; a < q; a++){
    scanf("%d",&t);
    if(binarySearch(s,n,t) != -1) count++;
  }

  printf("%d\n",count);
  return 0;
}

int binarySearch(int *p, int n, int key){
  int left=0, right=n, mid;
  
  while(left < right){
    mid = (left+right) / 2;
    if(*(p+mid) == key) return mid;
    else if(key < *(p+mid)) right = mid;
    else left = mid+1;
  }
  return -1;
}



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

int main()
{
    int w, h, n;
    cin >> w >> h >> n;
    int xl = 0;
    int yd = 0;
    int xr = w;
    int yu = h;
    rep(i, n) {
        int x, y, a;
        cin >> x >> y >> a;
        if(a == 1) xl = max(xl, x);
        if(a == 2) xr = min(xr, x);
        if(a == 3) yd = max(yd, y);
        if(a == 4) yu = min(yu, y);
    }
    int wi = max(0, xr - xl);
    int he = max(0, yu - yd);
    cout << wi * he << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (int i = (x), a = 0; a < (N);  \
                              i = (i + 1) % (N), ++a)

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, int){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, int){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;


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

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

        int k = min(a, b);
        for0(i, max(a, b))
            cout << k;

    return 0;
}


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

int main(){
  long int N,Q;
  long long int K;
  cin>>N>>K>>Q;
  vector<int> C(N,0);
  for(int i=0;i<Q;i++){
    long int a;
    cin>>a;
    C.at(a-1)++;
  }
  for(int i=0;i<N;i++){
    if(C.at(i)+K-Q>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }

}


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

int main(){
  string s; cin >> s;
  int n = s.size() - 1;
  
  ll ope = 0;
  string ans;
  
  
  for(int i = 0; i < (1<<n); i++){
    ll a = s.at(0) - '0';
    
    for(int j = 0; j < n; j++){
      ll b = s.at(j + 1) - '0';
      if(i&(1<<(n-j-1))){
        a += b;
      }else{
        a -= b;
      }
    }
    if (a == 7) {ope = i; break;}
  }
  
  ans.push_back(s.at(0));
  for(int i = 0; i < n; i++){
    if (ope&(1<<(n-i-1))){
      ans.push_back('+');
    }else{
      ans.push_back('-');
    }
    ans.push_back(s.at(i+1));
  }
  
  cout << ans << "=7" << endl;
}

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

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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N; cin >> N;
  VI xs(N);
  map<int,int> pos;
  REP(i,N){
	cin >> xs[i];
	pos[xs[i]] = i;
  }
  VI ys = xs;
  SORT(ys);
  REP(i,N) xs[pos[ys[i]]] = i;

  int ans = 0;
  REP(i,N) if(abs(xs[i] - i) % 2 != 0) ++ans;
  cout << ans/2 << endl;
  
  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
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; }
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

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

    ll N, M;
    cin >> N >> M;
    vec2 E(N, vec(N, INF));
    rep(i, M){
        ll a, b;
        cin >> a >> b;
        --a, --b;
        E[a][b] = E[b][a] = 1;
    }

    vec C(N - 1);
    iota(ALL(C), 1);
    ll ans = 0;
    perm(C){
        bool flag = true;
        ll prev = 0;
        for(auto c : C){
            if(E[prev][c] == INF){
                flag = false;
                continue;
            }
            prev = c;
        }
        ans += flag;
    }

    print(ans);

    return 0;
}

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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
template<class T> inline void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class K, class V> void cout_v(map<K, V>& m)
{ for(auto it=m.begin();it!=m.end();it++)cout<<it->first<<":"<<it->second<<endl;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
template<class T> inline bool is_overlap(const T& a, const T& b, const T& p, const T& q)
{ return p <=b && a <= q; }
#define MOD = 1000000007;
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int A,B,C,X,Y; cin >>A>>B>>C>>X>>Y;

    vector<int> prices;

    prices.push_back(A*X + B*Y);
    prices.push_back(C * 2* max(X, Y));
    if (X > Y) {
        prices.push_back(C*2*Y + A*(X-Y));
    } else {
        prices.push_back(C*2*X + B*(Y-X));
    }

    cout << *min_element(ALL(prices)) << endl;
}


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

int main(){

	int answer;
	int a,b,c,d,e,f;

	cin >> a >> b >> c >> d >> e >> f;
	
	int X = min(min(min(a, b), c), d);
	int Y = min(e, f);

	cout << a+b+c+d+e+f -X -Y << endl;


	/*
	int datanum = 0;
	for(int dataset = 0; dataset < 1; dataset++){
		if(input == 0) break;


		answer[dataset] = sum;

		datanum++;
	}

	for(int dataset = 0; dataset < datanum; dataset++){
		cout << answer[dataset] << endl;
	}
	*/

	

	return 0;
}


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

int main() {
	int n; cin >> n;
	int c = 0;
	for (int i = 1; i <= n; ++i) {
		int p; cin >> p;
		if (i != p && ++c > 2) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cctype>
#include<string>

using namespace std;

int main(){
    string key, word;
    int count = 0;
    
    cin >> key;
    for(int i = 0; i < key.size(); i++){
        key[i] = toupper(key[i]);
    }
    
    while(1){
        cin >> word;
        if(word[0] == 'E' && word[10] == 'T') break;
        for(int i = 0; i < word.size(); i++){
            word[i] = toupper(word[i]);
        }
        if(word == key) count += 1;
    }
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 3192
import itertools
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def judge(i,j):
    if j != 0:
        if l[i][j-1] == "#":
            return True
    if j != W-1:
        if l[i][j+1] == "#":
            return True
    if i != 0:
        if l[i-1][j] == "#":
            return True
    if i != H-1:
        if l[i+1][j] == "#":
            return True
    return False

H,W = IL()
l = [input() for i in range(H)]

for i in range(H):
    for j in range(W):
        if l[i][j] == "#":
            if judge(i,j) == False:
                print("No")
                exit()
print("Yes")


Measured memory_bytes: 14444
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a=1, b=0, N, K;
  cin >> N >> K;
  for (int i=0; i<N; i++){
    if (a*2<a+K) {
      a*=2;
    }
    else {
      a+=K;
    }
  }
  cout << a << endl;
}

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

using namespace std;
typedef long long ll;
#define int ll

signed main()
{
    ll n, k;
    string s;
    cin >> n >> k >> s;
    k--;
    s[k] -= 'A';
    s[k] += 'a';
    cout << s;
}


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

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

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

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

    int n;
    double sum = 0;
    cin >> n;
    for(int i =1 ;i <=n ; ++i)
    {
        double x; cin >> x;
        sum += 1.0 * 1/x;
    }
    cout <<  fixed <<  setprecision(8) << 1.0 * 1 / sum;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<=n;i++)
#define RIP(i,a,b) for(int i=a;i<b;i++)
#define all(V) V.begin(),V.end()
#define sec  setprecision;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops");
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
using ll = long long;
using ld = long double;
using Pa = pair<int, int>;
ll mod = 1000000007;
ll MOD = 998244353;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x) % mod, n / 2) % mod);
	else
		return (x * pow(x, n - 1)) % mod;
}
bool prime(int n) {
	int i = 2;
	if (n == 2)return true;
	else if(n <= 1)return false;
	if (n % i == 0)return false;
	i = 3;
	while (i <= sqrt(n)) {
		if (n % i == 0)return false;
		i += 2;
	}
	return true;
}
signed main() {
	int h, w; cin >> h >> w;
	vector<vector<bool>>s(h+2,vector<bool>(w+2,false));
	rip(i, h){
      rip(j, w) {
		char a; cin >> a;
		if (a == '#')s[i+1][j+1] = true;
		}
    }
	rip(i, h) {
		rip(j, w) {
			bool p = true;
          int k=i+1;int l=j+1;
			p = s[k-1][l]||s[k][l-1]||s[k+1][l]||s[k][l+1];
			if(p == false&&s[k][l]==true) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 3608
import java.util.*;

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

    int n = sc.nextInt();

    String[] d = new String[n];
    
    for (int i = 0; i < n; i++) {
      String s = sc.next();
      int p = sc.nextInt();
      d[i] = s + ":" + (1100 - p) + ":" + (i + 1);
    }

    Arrays.sort(d);

    for (int i = 0; i < n; i++) {
      String[] ans = d[i].split(":");
      System.out.println(ans[2]);
    }
  }
}


Measured memory_bytes: 21460
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main
{
	private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	}
    public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    }

    private static void sout()          { System.out.println();  }
    private static void sout(String s)  { System.out.println(s); }
    private static void sout(int s)     { System.out.println(s); }
    private static void sout(long s)    { System.out.println(s); }
    private static void sout(double s)  { System.out.println(s); }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}


Measured memory_bytes: 25672
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;

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

    vector<int> p(n);
    rep(i, 0, n) cin >> p[i];

    sort(p.begin(), p.end());

    int ans = 0;
    rep(i, 0, k) ans += p[i];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>

int main(){
		int n,t;
		scanf("%d%d",&n,&t);
		int i,small=1000,a,b,flag=0;
		for(i=0;i<n;i++){
			scanf("%d%d",&a,&b);
			if(b<=t){
				if(a<small)small=a;
				flag=1;
			}
		}
		if(flag==0)puts("TLE");
		else printf("%d",small);
		return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
# define rep(i,n) for(int i=0;i<n;i++)
// void solve(){
//     int n;
//     cin>>n;
//     vector<int> a(n);
//     rep(i,n)
//     cin>>a[i];
//     sort(a.begin(),a.end());


// }

void solve(){
    string s;
    cin>>s;
    int mx =0;
    int cnt =0 ;
    for(int i=0;i<3;i++){
        if(s[i]=='R')
        cnt++;
        else{
            mx = max(mx,cnt);
            cnt = 0;
        }
    }
    mx = max(cnt,mx);
    cout<<mx<<endl;
}


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

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  int n; cin >> n;
  V a(n+1);
  rep(i, n) cin >> a[i+1];

  for (int i = n; i > 0; i--) {
    rep2(j, 2, n/i + 1) {
      a[i] += a[i*j];
      a[i] %= 2;
    }
  }
  
  cout << count(ALL(a), 1) << endl;
  rep(i, n+1) {
    if (a[i]) cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main() {
  string N;
  cin>>N;
  if(N.at(0)==N.at(1)&&N.at(1)==N.at(2)||N.at(1)==N.at(2)&&N.at(2)==N.at(3)) {
    cout<<"Yes"<<endl;
  }
  
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long c = Long.parseLong(sa[1]);
		long[] x = new long[n + 2];
		long[] v = new long[n + 1];
		for (int i = 0; i < n; i++) {
			sa = br.readLine().split(" ");
			x[i + 1] = Long.parseLong(sa[0]);
			v[i + 1] = Long.parseLong(sa[1]);
		}
		x[n + 1] = c;
		br.close();

		long[] r1 = new long[n + 1];
		long[] r2 = new long[n + 1];
		for (int i = 1; i <= n; i++) {
			r1[i] = v[i] - (x[i] - x[i - 1]);
			r1[i] += r1[i - 1];
			r2[i] = v[i] - (x[i] - x[i - 1]) * 2;
			r2[i] += r2[i - 1];
		}
		for (int i = 1; i <= n; i++) {
			r1[i] = Math.max(r1[i], r1[i - 1]);
			r2[i] = Math.max(r2[i], r2[i - 1]);
		}

		long[] l1 = new long[n + 2];
		long[] l2 = new long[n + 2];
		for (int i = n; i >= 0; i--) {
			l1[i] = v[i] - (x[i + 1] - x[i]);
			l1[i] += l1[i + 1];
			l2[i] = v[i] - (x[i + 1] - x[i]) * 2;
			l2[i] += l2[i + 1];
		}
		for (int i = n; i >= 0; i--) {
			l1[i] = Math.max(l1[i], l1[i + 1]);
			l2[i] = Math.max(l2[i], l2[i + 1]);
		}

		long ans = 0;
		for (int i = 0; i <= n; i++) {
			long val1 = r1[i] + l2[i + 1];
			ans = Math.max(ans, val1);
			long val2 = r2[i] + l1[i + 1];
			ans = Math.max(ans, val2);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 49416
#include<iostream>
using namespace std;
bool solve(int i, int A[], int n, int m){
    if(m==0)    return true;
    else if(m<0 || i>=n)    return false;
    else{
        return solve(i+1, A, n, m-A[i]) || solve(i+1, A, n, m);
    }
}
int main(){
    int n;
    cin>>n;
    int A[n];
    for(int i=0; i<n; i++){
        cin>>A[i];
    }
    int q;
    cin>>q;
    int m[q];
    for(int i=0; i<q; i++)
        cin>>m[i];
    for(int i=0; i<q; i++){
        if(solve(0, A, n, m[i]))    cout<<"yes"<<endl;
        else    cout<<"no"<<endl;
    }
}


Measured memory_bytes: 3104
#!/usr/bin/env python3
#ABC73 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = [I() for _ in range(n)]
b = list(Counter(a).items())
ans = 0
for i,j in b:
    if j % 2:
        ans += 1
print(ans)


Measured memory_bytes: 55260
import java.util.Scanner;

public class Main {

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

		int[] L = new int[M];
		int[] R = new int[M];

		for(int i = 0 ; i < M ; i++) {
			L[i] = Integer.parseInt(sc.next());
			R[i] = Integer.parseInt(sc.next());
		}

		sc.close();

		//Logic
		int answerL = 0;
		int answerR = N;

		for(int i = 0; i < M ; i++) {
			answerL = Math.max(answerL, L[i]);
			answerR = Math.min(answerR, R[i]);
		}

		//Output
		int answer = answerR - answerL + 1;

		System.out.println(Math.max(answer, 0));

	}

}


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

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

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



int main() {
  int X;
  cin >> X;
  bool f = false;
  if(X >= 30) f = true;
  cans(f);
}



Measured memory_bytes: 3132
#include <stdio.h>
#define SIZE 100

const int inf = -1000000;
int d[400];
int Y, X;
char S[400];

enum status {
	EMPTY,
	AVAILABLE,
	FULL
};

typedef struct {
	int data[SIZE];
	int head;
	int tail;
	int flag;
}queue_t;

/*void printQueue(queue_t* pQueue) {
	for (int i = 0; i < SIZE; i++) {
		printf("%d",pQueue->data[i]);
	}
	printf("\n");
}*/

void initQueue(queue_t* pQueue) {
	for (int i = 0; i < SIZE; i++) pQueue->data[i] = 0;
	pQueue->head = 0;
	pQueue->tail = 0;
	pQueue->flag = EMPTY;
	//printQueue(pQueue);
}

void enqueue(queue_t* pQueue, int value) {
	//printf("enQ(%d)\n", value);
	if (pQueue->flag == FULL) {
		//printf("FULL\n");
		return;
	}
	pQueue->data[pQueue->tail] = value;
	if (pQueue->tail == SIZE - 1) pQueue->tail = 0;
	else pQueue->tail++;
	if (pQueue->tail == pQueue->head) pQueue->flag = FULL;
	else pQueue->flag = AVAILABLE;
	//printQueue(pQueue);
}

int dequeue(queue_t* pQueue) {
	//printf("deQ\n");
	if (pQueue->flag == EMPTY) {
		//printf("EMPTY\n");
		return 0;
	}
	int t = pQueue->data[pQueue->head];
	pQueue->data[pQueue->head] = 0;
	if (pQueue->head == SIZE - 1) pQueue->head = 0;
	else pQueue->head++;
	if (pQueue->tail == pQueue->head) pQueue->flag = EMPTY;
	else pQueue->flag = AVAILABLE;
	//printQueue(pQueue);
	return t;
}

void initd() {
	for (int i = 0; i < 400; i++) d[i] = inf;
}

int solve(int s,int dd[4]) {
	queue_t queue;
	queue_t* pQueue = &queue;
	initQueue(pQueue);
	initd();

	enqueue(pQueue, s);
	d[s] = 0;
	while (pQueue->flag != EMPTY) {
		int p = dequeue(pQueue);
		for (int i = 0; i < 4; i++) {
			int n = p + dd[i];
			if (0 <= n && (n == p + X || n == p - X || n / X == p / X) && n < X * Y &&
				S[n] != '#' && d[n] == inf) {
				enqueue(pQueue, n);
				d[n] = d[p] + 1;
			}
		}
	}
	int t = 0;
	for (int i = 0; i < X * Y; i++) if (d[i] > t) t = d[i];
	return t;
}

int main() {
	scanf("%d%d", &Y, &X);
	int dd[4] = { 1,X,-1,-X };
	int t = 0;
	for (int i = 0; i < Y;i++) {
		for (int j = 0; j < X; j++) {
			if (j == 0) scanf("\n%c", &S[t]);
			else scanf("%c", &S[t]);
			t++;
		}
	}

	int ans = 0, an = 0;
	for (int i = 0; i < Y * X; i++) {
		if (S[i] == '.') an = solve(i, dd);
		if (an > ans)ans = an;
	}
	printf("%d", ans);
	return 0;
}

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

int main(){
    int N;  cin >> N;
    vector<int> h(N);
    for(int i=0; i<N; i++)  cin >> h[i];
    
    int ans = 0;
    while(true){
        int s = -1;
        int g = -1;
        for(int i=0; i<N; i++){
            if(h[i]!=0 && s == -1){
                s = i;
                continue;
            }
            if(h[i]==0 && s != -1){
                g = i-1;
                break;
            }
        }
        if(s!=-1 && g == -1) g = N-1;
        if(s==-1) break;
        int nMizu = 100;
        for(int i=s; i<=g; i++){
            nMizu = min(nMizu, h[i]);
        }
        for(int i=s; i<=g; i++){
            h[i]-=nMizu;
        }
        ans += nMizu;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() 
{
    string str;
    cin >> str;
    
    int s = str.size();
    int count = 0;
    for(int i=0 ; i<(s/2) ; i++)
    {
        if(str[i] != str[s-i-1])
            count++;
    }
    
    cout << count;
    return 0;    
}


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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

ll a, b, n, res = -INF;

bool check(ll x) {
    ll tmp = a * x / b - a * (x / b);
    if (res < tmp) {
        res = tmp;
        return true;
    }
    return false;
}

void solve() {
    cin >> a >> b >> n;
    ll x = min(b - 1, n);
    cout << a * x / b - a * (x / b) << endl;
}


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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    LL(n,k);
    ll ans=0;
    vector<ll> vec(n+1),sum(n+1);
    for(ll i=0;i<=n;i++){
        vec[i]=i;
        if(i==0)sum[i]=0;
        else sum[i]=sum[i-1]+vec[i];
    }
    for(int kosuu=k;kosuu<=n;kosuu++){
        ans+=sum[n]-sum[n-kosuu]-sum[kosuu-1]+1;
        ans%=MOD;
    }
    ans++;
    out(ans);
}

Measured memory_bytes: 6360
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<assert.h>
#include<set>
#include<cmath>
#include<queue>
#include<cstdlib>
#include<iostream>
#include<bitset>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define rep(i,j,k) for(int i=(int)(j);i<=(int)(k);i++)
#define per(i,j,k) for(int i=(int)(j);i>=(int)(k);i--)
using namespace std;
typedef long long LL;
//template
typedef double db;
const db eps=1e-10;
const db pi=acosl(-1.0);
int sign(db x){if(x<-eps)return -1;if(x>eps)return 1;return 0;}
int cmp(db x,db y){return sign(x-y);}
bool inmid(db x,db l,db r){return cmp(x,l)*cmp(x,r)<=0;}
struct po{
	db x,y;
	po(db _x=0,db _y=0):x(_x),y(_y){}
	void read(){scanf("%lf%lf",&x,&y);}
};
po operator +(const po &a,const po &b){return po(a.x+b.x,a.y+b.y);}
po operator -(const po &a,const po &b){return po(a.x-b.x,a.y-b.y);}
po operator *(const po &a,const db &b){return po(a.x*b,a.y*b);}
po operator /(const po &a,const db &b){return po(a.x/b,a.y/b);}
db operator *(const po &a,const po &b){return a.x*b.x+a.y*b.y;}
db operator ^(const po &a,const po &b){return a.x*b.y-a.y*b.x;}
db mo2(po a){return a*a;}
db mo(po a){return sqrt(a*a);}
po proj(po x,po y){//proj x to y
	return y*((x*y)/mo2(y));
}
po refl(po x,po y){//refl x from y
	return proj(x,y)*2-x;
}
bool onseg(po x,po l,po r){
	return (sign((x-l)^(r-l))==0)&&inmid(x.x,l.x,r.x)&&inmid(x.y,l.y,r.y);
}
bool inter(db l1,db r1,db l2,db r2){
	if(cmp(l1,r1)==1)swap(l1,r1);
	if(cmp(l2,r2)==1)swap(l2,r2);
	return cmp(min(r1,r2),max(l1,l2))>=0;
}
bool checkss(po a,po b,po c,po d){
	return sign((b-a)^(c-a))*sign((b-a)^(d-a))<=0&&sign((d-c)^(a-c))*sign((d-c)^(b-c))<=0&&inter(a.x,b.x,c.x,d.x)&&inter(a.y,b.y,c.y,d.y);
}
po getll(po a,po b,po c,po d){
	db u=((b-a)^(c-a));
	db v=((d-a)^(b-a));
	return (c*v+d*u)/(u+v);
}
//template
int main(){
	int t;scanf("%d",&t);
	while(t--){
		po a,b,c,d;
		a.read();b.read();c.read();d.read();
		po w=getll(a,b,c,d);
		printf("%.10lf %.10lf\n",w.x,w.y);
	}
	return 0;
}






Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int A,B,C;
cin >> A >> B >> C;

cout << min(B/A,C);
}

Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
s = input()
if s.startswith("YAKI"):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 10184
#include<bits/stdc++.h>
#include<numeric>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i <= (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans;

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

	ll A, B, N;
	cin >> A >> B >> N;
	
	ans = A * min(N,B-1) / B;

	cout << ans << endl;

	return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    if(n%k == 0) cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << "[" << e << "] ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	vector<vector<int>> alpha(26);
	string s, t;
	cin >> s >> t;

	for (int i = 0; i < s.size(); i++) {
		alpha[s[i] - 'a'].emplace_back(i + 1);
	}

	DMP(alpha);
	int pre = 0;
	lint ans = 0;
	for (int i = 0; i < t.size(); i++) {

		int idx = t[i] - 'a';
		auto tmp = upper_bound(alpha[idx].begin(), alpha[idx].end(), pre);
		if (alpha[idx].empty()) {
			cout << -1 << "\n";
			return 0;
		}
		else if (tmp == alpha[idx].end()) {
			
			ans += s.size() - pre;
			pre = alpha[idx][0];
			ans += pre;

		}
		else {
			ans += *tmp - pre;
			pre = *tmp;
		}
	}

	cout << ans << "\n";

	return 0;
}

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

int main()
{
		int i, j;
		int num[3];
		cin >> num[0] >> num[1] >> num[2];

		for (i=0; i<2; i++) {
				for (j=2; j>i; j--) {
						if (num[j] < num[j-1]) {
								int temp = num[j];
								num[j] = num[j-1];
								num[j-1] = temp;
						}
				}
		}

		cout << num[0] << " " << num[1] << " " << num[2] << "\n";

		return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
#define FOR(i, s, e) for(int i = s; i < e; ++i)
void getValues(string& s, int& a, int & b)
{
	string::size_type p = s.find(',');
	string sa = s.substr(0, p);
	string sb = s.substr(p + 1);
	a = atoi(sa.c_str());
	b = atoi(sb.c_str());
}

int main()
{
	int w, n, a, b;
	cin >> w >> n;
	int W[31] = {};
	FOR(i, 1, w + 1) W[i] = i;
	string line;
	while (n--){
		cin >> line;
		getValues(line, a, b);
		swap(W[a], W[b]);
	}
	FOR(i, 1, w + 1) cout << W[i] << "\n";
	return 0;
}

Measured memory_bytes: 1216
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//templete
int main() {
	cout<<setprecision(20)<<fixed;
	int N;
	cin>>N;
	double ans=0;
	for(int i=0;i<N;i++){
		double a;
		cin>>a;
		ans+=1./a;
	}
	cout<<1./ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
    int key;
    Node *prev, *next;
};
Node *nil;

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insertNode(int key){
    Node *n = (Node *)malloc(sizeof(Node));
    n->key = key;
    n->next = nil->next;
    nil->next = n;
    n->next->prev = n;
    n->prev = nil;
}
void deleteNode(Node *n){
    if(n == nil){
        return;
    }
    n->prev->next = n->next;
    n->next->prev = n->prev;
    free(n);
}
void deleteFirstNode(){
    deleteNode(nil->next);
}
void deleteLastNode(){
    deleteNode(nil->prev);
}
Node* searchNode(int key){
    Node *target = nil->next;
    while(1){
        if(target == nil){
            return nil;
        }
        else if(target->key == key){
            return target;
        }
        else{
            target = target->next;
        }
    }
}
int main(){
    int num,key;
    char command[20];
    Node *target;
    init();
    scanf("%d",&num);
    for(int i=0;i<num;i++){
        scanf("%s%d",command,&key);
        if (command[0] == 'i'){
            insertNode(key);
        }
        else if(command[0] == 'd'){
            if(strlen(command)==6){
                deleteNode(searchNode(key));
            }
            else if(command[6]== 'F'){
                deleteFirstNode();
            }
            else if(command[6]== 'L'){
                deleteLastNode();
            }
        }
    }
    target = nil->next;
    while(1){
        if(target == nil){
            break;
        }
        if(target->next == nil){
            printf("%d\n",target->key);
        }
        else{
            printf("%d ",target->key);
        }
        target = target->next;
    }
    return 0;
}


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

using namespace std;

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

typedef long long ll;

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

    int n; cin>>n;
    int arr[n]; 
    for(int i=0; i<n; i++) cin>>arr[i];
    sort(arr, arr+n);
    int flag=1;
    for(int j=1; j<n; j++) if(arr[j-1]==arr[j]) {flag=0; break;}
    if(flag) cout<<"YES\n";
    else cout<<"NO\n";

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std ;
const int N = 2e3 + 10 ;
typedef long long ll ;
ll a[N] ;
vector<int> v[N] ;
ll dis[N][N] ;
ll ans[N] ;
int main()
{
  int n , x , y ;
  cin >> n >> x >> y ;
  for(int i = 1; i < y ;i ++)
   for(int j = i + 1 ;j < y ;j ++)
    dis[i][j] = j - i ;
  for(int i = x + 1 ;i <= n ;i ++)
   for(int j = i + 1 ;j <= n ;j ++)
    dis[i][j] = j - i ;
  dis[x][y] = 1 ;
  for(int i = 1;i <= x ;i ++)
   {
     for(int j = y ;j <= n ;j ++)
      dis[i][j] = dis[i][x] + 1 + dis[y][j] ;
   }
  for(int i = 1; i <= x ;i ++)
   {
     for(int j = x + 1 ;j < y ;j ++)
      dis[i][j] = min(dis[i][j] , dis[i][y] + dis[j][y]) ;
   }
  for(int i = x + 1 ;i <= y ;i ++)
   for(int j = y ;j <= n ;j ++)
    dis[i][j] = min(dis[i][j] , dis[x][i] + 1 + dis[y][j]) ;
  for(int i = x + 1 ;i < y ;i ++)
   for(int j = i + 1 ;j < y ;j ++)
    dis[i][j] = min(dis[i][j] , dis[x][i] + 1 + dis[j][y]) ;
  for(int i = 1 ;i <= n ;i ++)
   for(int j = i + 1 ; j <= n ;j ++)
    ans[dis[i][j]] ++ ; //, cout << i << " " << j << " " << dis[i][j] << endl ;
  for(int i = 1; i < n ;i ++)
   cout << ans[i] << endl ;
  return 0 ;
}


Measured memory_bytes: 31232
using System;
using System.Linq;
public class c
{
  public static void Main()
  {
    long[]ABK=Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    for(long i=ABK[0];i<=Math.Min(ABK[0]+ABK[2]-1,ABK[1]);i++)Console.WriteLine(i);
    for(long i=Math.Max(ABK[1]-ABK[2]+1,ABK[0]+ABK[2]);i<=ABK[1];i++)Console.WriteLine(i);
  }
}

Measured memory_bytes: 13268
import itertools

def is_lit(i, bit):
    l = [bit[j-1] for j in sockets[i]]
    return p[i] == l.count(True) % 2

count = 0
N, M = map(int, input().split())
bit_list = list(itertools.product([True, False], repeat = N))

sockets = []
for i in range(M):
    args = input().split(' ')
    k = int(args[0])
    sockets.append([int(args[i+1]) for i in range(k)])

p = [int(x) for x in input().split(' ')]

for bit in bit_list:
    o = [is_lit(i, bit) for i in range(M)]
    if o.count(True) == len(o):
        count += 1

print(count)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int CONTEST_NUM=26;

int score_function(const vector<int> &t,const vector<vector<int>> &s,const vector<int> &c,const int &d){
    vector<int> last(27);
    int manzoku=0;
    for(int i=1;i<=d;i++){
        manzoku+=s[i][t[i]];
        last[t[i]]=i;
        int sum=0;
        for(int j=1;j<=CONTEST_NUM;j++){
            sum+=c[j]*(i-last[j]);
        }
        manzoku-=sum;
    }
    return manzoku;
}

void set_ans(const vector<int> &t,vector<int> &ans,const int &d){
    for(int i=1;i<=d;i++){
        ans[i]=t[i];
    }
}

int main() {
    int d;cin>>d;
    vector<int> c(27);
    for(int i=1;i<=CONTEST_NUM;i++){
        cin>>c[i];
    }
    vector<vector<int>> s(d+1,vector<int>(27));
    for(int i=1;i<=d;i++){
        for(int j=1;j<=CONTEST_NUM;j++){
            cin>>s[i][j];
        }
    }
    vector<int> t(d+1);
    vector<int> ans(d+1);
    int old_ans=-1000000000;
    std::random_device rnd;
    std::mt19937 mt(rnd());
    std::uniform_int_distribution<> rand26(1,26);
    std::uniform_int_distribution<> randd(1,d);

    for(int i=1;i<=d;i++){
        int max_contest=-1;
        for(int j=1;j<=CONTEST_NUM;j++){
            if(max_contest<s[i][j]){
                max_contest=s[i][j];
                t[i]=j;
            }
        }
    }
    int k=0;
    while(k<220000){
        int che=randd(mt);
        int old_f=t[che];
        t[che]=rand26(mt);
        int tmp=score_function(t,s,c,d);
        if(tmp>old_ans){
            set_ans(t,ans,d);
            old_ans=tmp;
        }
        else{
            t[che]=old_f;
        }
        k++;
    }
    //cout<<old_ans<<endl;
    for(int i=1;i<=d;i++){
        cout<<ans[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 3696