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

#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl

using namespace std;
typedef long long ll;

const int maxn = 3003;

double p[maxn];
double dp[maxn][maxn];
ll n;

double go (ll idx, ll head){
    if (idx == n){
        ll tail = n - head;
        if (head > tail) return 1;
        else return 0;
    }
    double &ret = dp[idx][head];
    if (ret >= 0) return ret;
    ret = 0.0;
    ret = ret + p[idx] * go (idx + 1, head + 1) + (1.0 - p[idx]) * go (idx + 1, head);
    return ret;
}

int main(){
//    filein;
    for (ll i = 0; i < maxn; i++)
        for (ll j = 0; j < maxn; j++)
            dp[i][j] = -1.0;
    scanf ("%lld", &n);
    for (ll i = 0; i < n; i++)
        scanf ("%lf", &p[i]);
    printf ("%.10f\n", go (0, 0));
	return 0;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  map<ll, int> s;
  rep(i, n) {
    ll a;
    cin >> a;
    s[a]++;
  }
  ll a = 0, b = 0;
  for(auto v : s) {
    if(v.second >= 2) {
      b = a;
      a = v.first;
      if(v.second >= 4) b = v.first;
    }
  }
  cout << a * b << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>

#define MAX 7368792

using namespace std;

int main(void)
{
    int m, n, now;
    while (true)
    {
        cin >> m >> n;
        if (!m && !n) break;
        vector<int> years(MAX, true);
        for (now = m; now < MAX; now++)
        {
            if (years[now])
            {
                if (!n) break;
                for (int i = now; i < MAX; i += now) years[i] = false;
                n--;
            }
        }
        cout << now << endl;
    }
    return 0;
}



Measured memory_bytes: 31892
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    vector<int> a;
    for(int i = 0; i < 3; i++){
        int k;
        cin >> k;
        a.push_back(k);
    }
    sort(a.begin(), a.end());
    cout << a[2]*10 + a[0] + a[1] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;


public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int k = sc.nextInt();
		int r = sc.nextInt();
		int s = sc.nextInt();
		int p = sc.nextInt();
		String t = sc.next();
		char[] d = new char[n];
		long sum = 0;
		List<Character> list = new ArrayList<>();
		list.add('p');
		list.add('s');
		list.add('r');
		list.add('p');
		for (int i = 0; i < n; i++) {
			char ka = list.get(list.indexOf(t.charAt(i)) + 1);
			if (i < k || d[i - k] != ka) {
				d[i] = ka;
				if (ka == 'r') {
					sum += r;
				} else if (ka == 's') {
					sum += s;
				} else if (ka == 'p') {
					sum += p;
				}
			}
		}
		System.out.println(sum);
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 24148
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  long long D;
  scanf("%lld", &D);
  std::vector<long long> X(N);
  std::vector<long long> Y(N);
  int cnt = 0;
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &X[i]);
    scanf("%lld", &Y[i]);
    if (X[i] * X[i] + Y[i] * Y[i] <= D * D)
      cnt++;
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 6424
/*input
6
1 1 1 2 2 3
1 1 1 2 2 3
*/

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


int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[n-1-i];

    vector<int> cnt(n+1);
    int mcnt = 0;
    rep(i, n) {
        mcnt = max({mcnt, ++cnt[a[i]], ++cnt[b[i]]});
    }
    if (mcnt > n) {
        cout << "No" << endl;
        return 0;
    }
    else cout << "Yes" << endl;
    int l = 0, r = n-1;
    rep(i, n) {
        if (a[i] == b[i]) {
            if (a[i] != b[l] && a[l] != b[i]) {
                swap(b[i], b[l++]);
            }
            else swap(b[i], b[r--]);
        }
    }
    // rep(i, n) cout << a[i] << " ";
    // cout << endl;
    rep(i, n) cout << b[i] << " ";
    cout << endl;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  cin >> n >> m;
  set<ll> s;
  ll a,b;
  vector<pll> v;
  rep(i,m){
    cin >> a >> b;
    if(a > b)
      swap(a,b);
    v.pb(mp(a,b));
  }
  sort(all(v));
  rep(i,m){
    a = v[i].fi,b = v[i].se;
    if(a == 1){
      s.insert(b);
    }
    else if(b == n){
      if(s.find(a) != s.end()){
        std::cout << "POSSIBLE" << std::endl;
        return 0;
      }
    }
  }
  std::cout << "IMPOSSIBLE" << std::endl; 
  return 0;
}


Measured memory_bytes: 8300
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 N, M;
    cin >> N >> M;
    Vec<u64> H(N + 1);
    for (u32 i = 1; i <= N; i++) cin >> H[i];
    Vec<u64> MH(N + 1, 0);
    for (int i = 0; i < M; i++) {
        u32 A, B;
        cin >> A >> B;
        MH[A] = max(H[B], MH[A]);
        MH[B] = max(H[A], MH[B]);
    }
    u32 sum = 0;
    for (int i = 1; i <= N; i++) {
        sum += H[i] > MH[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 4760
a, b, c = $<.read.split.map(&:chomp)

win = ''
str_next = 'a'

loop do
	case str_next
		when 'a'
			if a.size == 0
				win = 'A'
				break
			end
			str_next = a.slice!(0)
		when 'b'
			if b.size == 0
				win = 'B'
				break
			end
			str_next = b.slice!(0)
		when 'c'
			if c.size == 0
				win = 'C'
				break
			end
			str_next = c.slice!(0)
	end
end

puts win

Measured memory_bytes: 1916
from collections import deque

N= int(input())

A = list(map(int, input().split()))
A.reverse()
B = deque()
    
if N%2==0:
    for i in range(N):
        if i%2==0:
            B.append(A.pop())
        else:
            B.appendleft(A.pop())
else:
    for i in range(N):
        if i%2!=0:
            B.append(A.pop())
        else:
            B.appendleft(A.pop())

[print("{} ".format(b),end="") for b in B ]


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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;

//atcoder
//abc165

int main()
{
    long long a[4000];

    a[0] = 100;

    for (int i = 1; i < 3762; ++i)
    {
        a[i] = a[i-1] + (0.01*a[i-1]);
    }

    long long t;
    cin>>t;

    for (int i = 0; i < 3762; ++i)
    {
        if(a[i]>=t)
        {
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;


int main(){
   string w;
   cin>>w;
   int a[26];
   rep(i,26){
      a[i]=0;
   }
   rep(i,w.size()){
      a[w[i]-'a']++;
   }
   bool flag=true;
   rep(i,26){
      if(a[i]%2!=0) flag=false;
   }
   flag? cout<<"Yes":cout<<"No";
   

return 0;
}


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

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

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

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    int a[100010];
    int b[100010];
    int sum=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        b[i]=0;
    }
    for(int i=1;i<=n;i++){
        if(a[i]<=100000){
            b[a[i]]++;
        }
    }
    int pre_sum=0;
    for(int i=1;i<=n;i++){
        pre_sum+=b[i];
    }
    for(int i=1;i<=n;i++){
        if(b[i]>=i)sum+=b[i]-i;
        else sum+=b[i]; 
    }
    cout<<n-pre_sum+sum<<endl;


    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 998244353;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

long long fac[MAX], finv[MAX], inv[MAX];

int main(){
    int X;
    cin >> X;
    int cnt = 0;
    int ans = 0;
    while(true){
        cnt += X;
        cnt %= 360;
        ans++;
        if(cnt == 0){
            cout << ans << endl;
            break;
        }
    }
}

Measured memory_bytes: 3564
//tanzim bin nasir
#include<bits/stdc++.h>
typedef long long ll;
#define ff first
#define ss second
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
int main()
{
     ll k;
     cin>>k;
     ll temp=7,ans=1;
     if(k%2==0)
     {
         cout<<"-1\n";
         return 0;
     }
     for(int i=1;i<100000000;i++)
     {
         temp=temp%k;
         if(temp==0)
         {
             cout<<ans<<endl;
             return 0;
         }
         ans++;
         temp=temp*10+7;
     }
     cout<<"-1\n";
     return 0;
}


Measured memory_bytes: 3620
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int sum[2001][2001];
int solve(int i,int j){
  if(i >= 0 && j >= 0)
    return sum[i][j];
  else
    return 0;
}
int main()
{
  int N,K,x[100001],y[100001],c[100001],ma = -1,cnt;
  char d;
  cin >> N >> K;
  REP(i,N){
    cin >> x[i] >> y[i] >> d;
    x[i] %= 2*K;
    c[i] = d == 'B' ? 1 : 0;
    if(c[i] == 0){
      y[i] = (y[i] + K) % (2*K);
    }else
      y[i] = (y[i]%(2*K));
  }
  REP(i,2001)REP(j,2001)sum[i][j] = 0;
  REP(i,N){
    sum[x[i]][y[i]]++;
  }
  for(int i=0;i<2001;i++)
    for(int j=0;j<2001;j++){
      if(i == 0 && j == 0)
        continue;
      if(i == 0){
        sum[i][j] += sum[i][j-1];
        continue;
      }else if(j == 0){
        sum[i][j] += sum[i-1][j];
        continue;
      }else{
        sum[i][j] += sum[i-1][j];
        sum[i][j] += sum[i][j-1];
        sum[i][j] -= sum[i-1][j-1];
      }
  }
  
  REP(k,K){
    REP(j,K){
      cnt = 0;
      cnt += solve(K-1+j,K-1+k) - solve(j-1,K-1+k) - solve(K-1+j,k-1) + solve(j-1,k-1);
      cnt += solve(2*K-1,2*K-1) - solve(K-1+j,2*K-1) - solve(2*K-1,K-1+k) + solve(K-1+j,K-1+k);
      cnt += solve(j-1,k-1);
      cnt += solve(2*K-1,k-1) - solve(K-1+j,k-1);
      cnt += solve(j-1,2*K-1) - solve(j-1,K-1+k);
      ma = max(ma,cnt);
      ma = max(ma,N-cnt);
    }
  }
  cout << ma << endl;
  return 0;
}



Measured memory_bytes: 16640
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
#define INF 100000000
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define rep(i, n) for(int (i)=1; (i)<=(n); (i)++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    string Sp, T;
    cin >> Sp >> T;
    int nS = (int)Sp.size();
    int nT = (int)T.size();

    for(int St = nS-nT; St >= 0; --St){ //開始位置を変更
        bool OK = true;
        for(int t=0; t < nT; ++t){
            if(Sp[St + t] != '?' && Sp[St + t] != T[t]){
                OK = false;
                break;
            }
        }
        if(OK){ //文字列が適合していたら
            string S = Sp;
            for(int t=0; t<nT; ++t){ //置換
                S[St+t] = T[t];
            }
            for(int s = 0; s < nS; ++s){
                if(S[s] == '?') S[s] = 'a'; //文字列Sの?の部分をすべてaに置換
            }
            cout << S << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

int main(){
	int n;
	map<int, int> cnt;
	int a[100000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		cnt[a[i]]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++){
		if (cnt[a[i]] < a[i]){
			ans += cnt[a[i]];
			cnt[a[i]] = 0;
		}
		else if(cnt[a[i]] > a[i]){
			ans += cnt[a[i]] - a[i];
			cnt[a[i]] = a[i];
		}
	}
	printf("%d\n", ans);

	return 0;
}

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

typedef long long ll;
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
#endif
	int n;
	cin>>n;
	int n1=n/500;
	n%=500;
	int n2=n/5;
	int ans=n1*1000+n2*5;
	cout<<ans<<endl;

	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int h, w;
  cin >> h >> w;
  int ans = 0;
  for (int i = 0; i < n; i++) {
	int a, b;
	cin >> a >> b;
	if (a >= h && b >= w) {
	  ans++;
	}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def main():
    k = int(input())
    sum_ = 0

    for i in range(1, k+1):
        sum_ += i
        for j in range(i+1, k+1):
            sum_ += gcd(i, j) * 6
            for l in range(j+1, k+1):
                sum_ += gcd(i, j, l) * 6

    print(sum_)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b;
	
	cin>>a>>b;
if(a<b)
{
for(ll i=1;i<=b;i++)
cout<<a;
	
}
else
{
for(ll i=1;i<=a;i++)
cout<<b;
	
}
	
}

Measured memory_bytes: 256
def fib(n):
    if n == 0 or n == 1:
        return 1
    else:
        seq = [0 for _ in range(n+1)]
        seq[0], seq[1] = 1, 1
        for i in range(2,n+1):
            seq[i] = seq[i-1] + seq[i-2]
        return seq[n]

if __name__ == '__main__':
    print(fib(int(input())))


Measured memory_bytes: 5604
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let n: usize = sc.read();
    let k: usize = sc.read();
    let mut a: Vec<usize> = sc.vec(n);
    let mut f: Vec<usize> = sc.vec(n);
    a.sort();
    f.sort_by(|a, b| b.cmp(a));
    let ans = bis_usize(1_000_000_000_001, 0, |x| {
        let mut lsn = k;
        for i in 0..n {
            let scr = a[i] * f[i];
            if scr > x - 1 {
                let ned = (scr - (x - 1) + f[i] - 1) / f[i];
                if lsn >= ned {
                    lsn -= ned;
                } else {
                    return false;
                }
            }
        }
        true
    });
    format!("{}\n", ans - 1)
}
#[test]
fn test_solve() {
    assert_eq!(solve("3 5\n4 2 1\n2 3 1\n"), "2\n");
    assert_eq!(solve("3 8\n4 2 1\n2 3 1\n"), "0\n");
    assert_eq!(
        solve("11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 2 3 8 4 6 2\n"),
        "12\n"
    );
}
fn bis_usize<P>(t: usize, f: usize, eval: P) -> usize
where
    P: Fn(usize) -> bool,
{
    if t + 1 == f || f + 1 == t {
        return t;
    }
    let m = (t + f) >> 1;
    if eval(m) {
        bis_usize(m, f, eval)
    } else {
        bis_usize(t, m, eval)
    }
}
fn main() {
    let mut buf = String::new();
    use std::io::{Read, Write};
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<I> {
    src: I,
}
impl<'a> Scanner<std::str::SplitWhitespace<'a>> {
    fn from_str(src: &'a str) -> Self {
        Scanner {
            src: src.split_whitespace(),
        }
    }
}
#[allow(dead_code)]
impl<'a, I> Scanner<I>
where
    I: std::iter::Iterator<Item = &'a str>,
{
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.src.next().unwrap().parse().ok().expect("Parse error")
    }
    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    fn chars(&mut self) -> Vec<char> {
        self.src.next().unwrap().chars().collect()
    }
}


Measured memory_bytes: 14072
# include<bits/stdc++.h>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 1000000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
# define AU(i,x)    for(auto i=x.begin(); i!=x.end(); ++i)
# define ALL(A) A.begin(),A.end()
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
inline char nc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int Scan(){
    char ch=nc();int sum=0, f=1;
    if (ch=='-') f=-1, ch=nc();
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum*f;
}
int ps4[4][2]={0,1,0,-1,1,0,-1,0};
int ps8[8][2]={0,1,0,-1,1,0,-1,0,1,1,1,-1,-1,-1,-1,1};
inline int min(int a,int b,int c) {return min(a,min(b,c));}
inline int max(int a,int b,int c) {return max(a,max(b,c));}
inline int min(int a,int b,int c,int d){return min(min(a,b,c),d);}
inline int max(int a,int b,int c,int d){return max(max(a,b,c),d);}
//struct Edge{int p, next, w;}edge[maxn];
//inline add_edge(int u, int v, int w){edge[cnt]=Edge{v,head[u],w}; head[u]=cnt++;}
const int N=200005;
///Code begin..................................................................

LL A[N];

LL pow_mod(LL a, LL n, LL mod){
    LL ret=1, tmp=a%mod;
    while (n) {
        if (n&1) ret=ret*tmp%MOD;
        tmp=tmp*tmp%MOD;
        n>>=1;
    }
    return ret;
}
LL inv(LL a, LL mod){return pow_mod(a,mod-2,mod);}
void init(){
    A[0]=1; FOR(i,1,N-1) A[i]=A[i-1]*i%MOD;
}
LL C(int x, int y){
    return A[y]*inv(A[x]*A[y-x]%MOD,MOD)%MOD;
}
int main ()
{
    init();
    int H, W, A, B;
    scanf("%d%d%d%d",&H,&W,&A,&B);
    LL ans=0;
    FOR(i,1,W-B) ans+=C(H-A-1,B+H-A+i-2)*C(A-1,A+W-B-i-1)%MOD;
    printf("%lld\n",ans%MOD);
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
      int[] L = new int[N];
      int i=0;
      long count =0;
      for(i=0;i<N;i++){
        L[i]=sc.nextInt();
      }
		Arrays.sort(L);
      int j=0;
      
      for(i=N-1;i>0;i--){
        for(j=0;j<i;j++){
        	for(int k=i-1;L[j]+L[k]>L[i]&&k>j;k--){
           			count++;
            }
        }
      }
        
      System.out.println(count);

    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define f first
#define s second

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

const ll INF= ll (1e18);
const int MOD= 1e9+7;
const int N=200000+10;

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

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

    a+=b;

    if(a>=24)
        a-=24;

    cout<<a<<endl;

    return 0;
}



Measured memory_bytes: 256
n = int(input())
count=0
temp=0
xtemp=0
ytemp=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if abs(t-temp)>=abs(x-xtemp)+abs(y-ytemp) and (x-xtemp+y-ytemp-(t-temp))%2==0:
        count=count+1
    temp=t
    xtemp=x
    ytemp=y
if count==n:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int h,a;
	scanf("%d %d",&h,&a);
	if(h<a) printf("1\n");
	else
	{
		int tip=h%a;
		if(tip!=0) tip=1;
		printf("%d\n",h/a+tip); 
	}
	return 0;
} 

Measured memory_bytes: 128
// ATCoder
// 所要時間 分
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int main() {

    string s;
    cin >> s;
    
    int ans = 0;
    int cnt = 0;
    rep(i, s.length()){
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
            cnt++;
        }
        else{
            cnt = 0;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

void we_r_done(){cout<<"NO"; exit(0);}

void debug(string mssg){cout<<mssg; exit(0);}

using minHeap = priority_queue< int, vector< int >, greater< int > >;

#define N 100005
lli dp[101][N];

int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;

    int n,W;
    scn2(n,W);

    int w[n+1] , v[n+1];

    for(int i=1; i<=n; i++){
        scn2(w[i],v[i]);

    }

    for(int make=1; make<N; make++){

        dp[0][make] = inf+inf;

        for(int i=1; i<=n; i++){

            if(v[i]<=make) dp[i][make] = min(dp[i-1][make] , dp[i-1][make-v[i]] + w[i]);
            else dp[i][make] = dp[i-1][make];
        }
    }
    //cout<<dp[n][90]<<" "<<dp[n][30]<<" "<<dp[n][60]<<" "<<dp[2][30]<<" "<<dp[1][30]<<endl;

    for(int make=N-1; make>=0; make--){
        if(dp[n][make]<=W){
            cout<<make;
            break;
        }
    }

    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?


Measured memory_bytes: 79104
/**
 *    author:  tourist
 *    created: 01.01.2020 20:07:20       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  string t;
  cin >> t;
  for (int i = n; i >= 0; i--) {
    if (s.substr(n - i) == t.substr(0, i)) {
      cout << n + n - i << '\n';
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int x1, x2, x3, x4, x5;
    cin>> x1 >> x2 >> x3 >> x4 >> x5;
    int ans = 0;
    if(x1 == 0) ans = 1;
    if(x2 == 0) ans = 2;
    if(x3 == 0) ans = 3;
    if(x4 == 0) ans = 4;
    if(x5 == 0) ans = 5;
    cout << ans << endl;
}

Measured memory_bytes: 3592
s = input()
s1, s2 = [], []

ans = 0
for i in range(len(s)):
    if s[i] == "\\":
        s1.append(i)
    if s[i] == "/" and s1:
        j = s1.pop()
        a = i - j
        ans += a
        while s2 and s2[-1][0] > j:
            a += s2.pop()[1]
        s2.append([j, a])
print(ans)
print(len(s2), *(a for j, a in s2))

Measured memory_bytes: 7500
def is_palindrome(s):
    if s == s[::-1]:
        return True
    else:
        return False

S = input()
N = len(S)
if is_palindrome(S) and is_palindrome(S[0:(N-1)//2]) and is_palindrome(S[(N+3)//2-1:]):
    print("Yes")
else:
    print("No")


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = (int) s.size();
    int x = 0, y = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '1') {
            x++;
            if (y) {
                ans++;
                x--;
                y--;
            }
        } else {
            y++;
            if (x) {
                ans++;
                x--;
                y--;
            }
        }
    }
    cout << ans * 2 << '\n';
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n, T;
    scanf("%d%d", &n, &T);
    vector<int> a(n);
    int i;
    ll sum = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        if (i > 0) sum += MIN(T, a[i] - a[i - 1]);
    }
    printf("%lld\n", sum+T);
    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


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

int main(){
	int a,b;
	cin>>a>>b;
	
	long long i=1;
	long long n=0;
	bool flag=false;
	
	while(flag==false){
		n=a*i;
		i++;
		if(n%b==0) flag=true;
	}
	cout << n << endl;
}

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

int main() {
    int l, r;
    cin >> l >> r;
    int ans = INF;
    if(l - r > 2019){
        cout << 0 << endl;
        return 0;
    }
    for(int i = l; i < r; i++){
        for(int j = i+1; j <= r; j++){
            int ii = i % 2019;
            int jj = j % 2019;
            ans = min(ans, ii*jj % 2019);
            if(ans == 0) break;
        }
        if(ans == 0) break;
    }
    cout << ans % 2019 << endl;
    return 0;
}

Measured memory_bytes: 3628
N = int(input())
H = list(map(int,input().split()))
DP = [0]
for i in range(1,N):
    a = DP[i-1] + abs(H[i]-H[i-1])
    b = DP[i-2] + abs(H[i]-H[i-2]) if i>1 else float("inf")
    DP.append(min(a,b))
print(DP[N-1])

Measured memory_bytes: 13800
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// END NO SAD

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

pii l[3005];
int dpA[3005][3005];
int dpB[3005][3005];
void solve() {
  int n, t;
  cin >> n >> t; t--;
  for(int i = 0; i < n; i++) cin >> l[i].first >> l[i].second;
  int ret = 0;
  for(int i = 0; i < n; i++) {
    for(int x = t; x >= l[i].first; x--) {
      dpA[i+1][x] = max(dpA[i+1][x], dpA[i][x-l[i].first] + l[i].second);
    }
    for(int x = t; x >= l[n-1-i].first; x--) {
      dpB[i+1][x] = max(dpB[i+1][x], dpB[i][x-l[n-1-i].first] + l[n-1-i].second);
    }
    for(int x = 0; x <= t; x++) {
      dpA[i+1][x] = max(dpA[i+1][x], dpA[i][x]);
      dpB[i+1][x] = max(dpB[i+1][x], dpB[i][x]);
    }
  }
  for(int i = 0; i < n; i++) {
    for(int x = 0; x <= t; x++) {
      ret = max(ret, dpA[i][x] + dpB[n-i-1][t-x] + l[i].second);
    }
  }
  cout << ret << "\n";
}

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


Measured memory_bytes: 70784
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gya[200010];
ll kai[200010];
ll beki(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k%2==1){
            ret*=now;
            ret%=mod;
        }
        now*=now;
        now%=mod;
        k/=2;
    }
    return ret;
}
ll gyaku(ll n){
    return beki(n,mod-2);
}
void nckinit(ll n){
    kai[0]=1;
    kai[1]=1;
    for(int i=2;i<=n;i++){
        kai[i]=kai[i-1]*i;
        kai[i]%=mod;
    }
    gya[n]=gyaku(kai[n]);
    for(int i=n-1;i>=1;i--){
        gya[i]=gya[i+1]*(i+1);
        gya[i]%=mod;
    }
    gya[0]=1;
}
ll nck(ll n,ll k){
    if(k<0)return 0;
    if(k==0||n==k)return 1;
    ll ret=kai[n];
    ret*=gya[n-k];
    ret%=mod;
    ret*=gya[k];
    ret%=mod;
    return ret;
}
ll npk(ll n,ll k){
    if(k<0)return 0;
    if(k==0)return 1;
    ll ret=kai[n];
    ret*=gya[n-k];
    ret%=mod;
    return ret;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;cin>>n>>k;
    nckinit(n+k+2);
    rep(i,1,k+1){
        if(i>n-k+1){
            cout<<0<<endl;
            continue;
        }
        ll ans=nck(n-k+1,i);
        ll t=nck(k-1,i-1);
        ans*=t;
        ans%=mod;
        cout<<ans<<endl;
    }
}


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

  int x;
  cin>>x;

  if(400<=x && x<=599)cout<<"8"<<endl;
   else if(600<= x && x<=799)cout<<"7"<<endl;
    else if(800<= x && x<=999)cout<<"6"<<endl;
     else if(1000<= x && x<=1199)cout<<"5"<<endl;
      else if(1200<= x && x<=1399)cout<<"4"<<endl;
      else if(1400<= x && x<=1599)cout<<"3"<<endl;
       else  if(1600<= x && x<=1799)cout<<"2"<<endl;
         else if(1800<= x && x<=1999)cout<<"1"<<endl;




return 0;}



Measured memory_bytes: 3628
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = 100003;
        int[] prime = new int[n - 1];
        for (int i = 0; i < prime.length; i++) {
            prime[i] = 2 + i;
        }
        int k = 0;
        while (prime[k] <= Math.sqrt(n)) {
            if (prime[k] == 0) {
                k++;
                continue;
            }
            for (int i = k + 1; i < prime.length; i++) {
                if (prime[i] % prime[k] == 0) {
                    prime[i] = 0;
                }
            }
            k++;
        }
        for (int i = 0; i < prime.length; i++) {
            if (prime[i] >= x) {
                System.out.println(prime[i]);
                break;
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 22484
#include <stdio.h>

int main (){

int L, R, d, ctr = 0;

scanf ("%d %d %d", &L, &R, &d);

while (L <= R) {
	
	if ( L % d == 0) {
		ctr = ctr + 1;
	}
	L++;
}

	printf("%d", ctr);
}

Measured memory_bytes: 1724
s = gets.chomp
if s == s.reverse && s[0..((s.length - 1) / 2 - 1)] == s[0..((s.length - 1) / 2 - 1)].reverse && s[((s.length + 3) / 2 - 1)..s.length] == s[((s.length + 3) / 2 - 1)..s.length].reverse
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
num = int(input())
for i in range(num):
    a, b, c = map(int, input().split())
    a2 = a ** 2
    b2 = b ** 2
    c2 = c ** 2
    if a2 + b2 == c2 or a2 + c2 == b2 or c2 + b2 == a2 :
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 7644
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
ll dp[105][2][4];
int main(){
  string s;
  cin>>s;
  ll k;
  cin>>k;
  ll n=sz(s);
  memset(dp,0,sizeof(dp));
  dp[0][0][0]=1;
  rep(i,n){
    ll nd=s[i]-'0';
    rep(j,2){
      rep(z,4){
        rep(u,10){
          ll ni=i+1,nj=j,nz=z;
          if(nj==0&&nd<u) continue;
          if(nj==0&&nd>u) nj=1;
          if(u!=0) nz++;
          if(nz>3) continue;
          dp[ni][nj][nz]+=dp[i][j][z];
        }
      }
    }
  }
  COUT(dp[n][0][k]+dp[n][1][k]);
}


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

int main() {
  long long int a,b,c,d,ss;
  cin>>a>>b>>c>>d;
  if(c<d){
    ss=c;
    c=d;
    d=ss;
  }
  
  long long int r=c%d,e=c,f=d,g;
  while(r!=0){
    c=d;
    d=r;
    r=c%d;
  }
  g=e*f/d;
  
  long long int s1=b-(b/e)-(b/f)+(b/g),s2=a-1-((a-1)/e)-((a-1)/f)+((a-1)/g);
  cout<<s1-s2<<endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
	ll n, m, k;
	cin >> n >> m >> k;
	vector<ll> a(n + 1, 0);
	vector<ll> b(m + 1, 0);

	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for(int i = 1; i <= m; ++i)
	{
		cin >> b[i];
		b[i] += b[i - 1];
	}

	int ans = 0;
	for(int i = 0; i <= n; ++i)
	{
		if (k - a[i] < 0) continue;
		auto b_iter = upper_bound(b.begin(), b.end(), k - a[i]);
		int b_ind = distance(b.begin(), b_iter);
		ans = max(ans, i + b_ind - 1);
	}
	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 6344
import java.util.Scanner;
 class Main {

	public void so() {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int b = sc.nextInt();

		int c = sc.nextInt();

		if(a < b) {

			if(c < b) {

				if(a < c) {

					System.out.println(a + " " + c + " " + b);

				} else {

					System.out.println(c + " " + a + " " + b);

				}

			} else {

				System.out.println(a + " " + b + " " + c);

			}

		}

		if(b < a) {

			if(c < a) {

				if(c < b) {

					System.out.println(c + " " + b + " " + a);

				} else {

					System.out.println(b + " " + c + " " + a);

				}

			} else {

				System.out.println(b + " " + a + " " + c);

			}

		}

	}

	public static void main(String[] args) {

		new Main().so();

	}

}

Measured memory_bytes: 26252
import sys
sys.setrecursionlimit(10**5)

def L(): return [x for x in input().split()]
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LI_(): return [-1*int(x) for x in input().split()]
def II(): return int(input())
def IF(): return float(input())
def LM(func,n): return [[func(x) for x in input().split()]for i in range(n)]
mod = 1000000007
inf = float('INF')
dic = {"m":1000,"c":100,"x":10,"i":1}

def MCXI(S):
    ret = 0
    for d in "mcxi":
        i =S.find(d)
        if i >=1 and "2"<=S[i-1]<="9":
            ret  += int(S[i-1])*dic[d]
        elif i>=0:
            ret += dic[d]
    return ret
def mcxi(n):
    S = ""
    for d in "ixcm":
        if n%10 == 1:
            S += d
        elif n%10 > 1:
            S += d
            S += str(n%10)
        n //= 10
    return S[::-1]


n = II()

for i in range(n):
    a,b = L()
    a = MCXI(a)
    b= MCXI(b)
    print(mcxi(a+b))


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

int main(){
  int N, M;
  cin >> N >> M;

  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
   cin >> vec.at(i);
  }

  int S=0;
  for (int i = 0; i < N; i++) {
   S+=vec.at(i);
  }

  int res=0;
  int jde=S;
  
  for (int i = 0; i < N; i++) {
   int64_t x;
   x=vec.at(i)*4*M;
   if (x>=jde) res+=1;
  }
  
  bool ans = false;
  if (res>=M) ans=true;
  
  if (ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
} 

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

int main() {
int64_t n,ans;
  ans=0;
  cin>>n;
 vector<int64_t> vec(n);
  for(int64_t i=0;i<n;i++){
  cin>>vec.at(i);
  }
  for(int64_t i=0;i<n;i++){
    for(int64_t j=0;j<n;j++){
      for(int64_t k=0;k<n;k++){
        int64_t a=vec.at(i);
         int64_t  b=vec.at(j);
          int64_t c=vec.at(k);
      if(a!=b&&b!=c&&c!=a&&a+b>c&&b+c>a&&c+a>b){ans++;}
      }
    }
  }
  cout<<ans/6<<endl;
}

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

int main(){
  vector<int> L(26,0);
  vector<int> R(26,0);
  int N; cin>>N;
  vector<int> ans(N+1,0);
  string S; cin>>S;
  for(int i=0;i<N+1;i++){
    for(int j=0;j<N;j++){
      if(i>j)
        L[S[j]-'a']++;
      else
        R[S[j]-'a']++;
    }
    for(int j=0;j<26;j++){
      if(L[j]&&R[j])
        ans[i]++;
      L[j]=R[j]=0;
    }
  }
  sort(ans.begin(),ans.end());
  cout<<ans[N]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

vector<long long> w[4];


int main(void){
	int N, W;
	cin >> N >> W;
	long long wbase;

	for (int i = 0; i < N; i++){
		int wtmp, vtmp;
		cin >> wtmp >> vtmp;
		if (i == 0) wbase = wtmp;
		w[wtmp - wbase].push_back(vtmp);
	}

	for (int i = 0; i < 4; i++){
		sort(w[i].begin(), w[i].end(), greater<long long>());
	}
	for (int i = 0; i < 4; i++){
		w[i].insert(w[i].begin(), 0);
	}

	for (int i = 0; i < 4; i++){
		for (unsigned int j = 1; j < w[i].size(); j++){
			w[i][j] += w[i][j-1];
		}
	}

/*	for (int i = 0; i < 4; i++){
		for (unsigned int j = 0; j < w[i].size(); j++){
			printf("%lld ", w[i][j]);
		}
		printf("\n");
	}*/




	long long max = -1;

	for (unsigned int i = 0; i < w[0].size(); i++){
		for (unsigned int j = 0; j < w[1].size(); j++){
			for (unsigned int k = 0; k < w[2].size(); k++){
				for (unsigned int l = 0; l < w[3].size(); l++){
					if ((wbase)*(i)+(wbase+1)*(j)+(wbase+2)*(k)+(wbase+3)*(l) <= W){
						max = max<w[0][i]+w[1][j]+w[2][k]+w[3][l]?w[0][i]+w[1][j]+w[2][k]+w[3][l]:max;
					}
				}
			}
		}
	}

	printf("%lld\n", max);

	return 0;

}



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

int main() {
  
  int A,B;
  cin >> A >> B;
  
  if (A>B) cout << 2*A-1 << endl;
  if (A==B) cout << A+B << endl;
  if (A<B) cout << 2*B-1 << endl;
  
}

Measured memory_bytes: 256