akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = (int)Math.pow(a,2);
        int c = (int)Math.pow(a,3);
        System.out.println(a+b+c);
    }
}


Measured memory_bytes: 35776
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

ll f(char c) {
  return c-'0';
}

int main() {
  ll a;
  string s;
  cin >> a >> s;
  ll b = 0;
  b += f(s[0]) * 100;
  b += f(s[2]) * 10;
  b += f(s[3]);
  ll ans = a*b/100;
  cout << ans << endl;

  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  
  for (int j = 0; j < N; j++){
    int l,r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char s1[102];
    char s2[204];
   scanf("%s",s1);
   scanf("%s",s2);
    strcat(s2,s1);
    int k=strlen(s2);
    s2[k]='\0';
    printf("%s\n",s2);
    return 0;
}


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

#define LL long long

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    int n; cin >> n; int a[n]; for(int &i : a) cin >> i;
    sort(a, a+n);
    cout << a[n/2] - a[n/2 - 1];    
}

Measured memory_bytes: 4044
N = int(input())
s = input()

def sheep_wolf_allocator(given_string ,first_allocate, second_allocate):
    '''
    与えられた文字列を満たすように1...Nまで羊/狼を割り当てる。
    最後にN匹目と1匹目の検証を行う。
    
    引数
    ------------------------------
    given_string: 動物の主張 ooxoxox..
    first_allocate: 1番に割り当てる動物(S/W)
    second_allocate: 2番に割り当てる動物(S/W)
    
    戻り値
    ------------------------------
    検証失敗時 -> -1
    swallocation: 羊/狼の割当結果文字列, 検証失敗時は返さない
    '''
    
    def verse(ws_char):
        if ws_char == "W":
            return "S"
        else:
            return "W"
        
    
    # allocation
    swallocation = []
    swallocation.append(first_allocate)
    swallocation.append(second_allocate)
    
    N = len(given_string)
    
    for pi in range(1, N):
        if swallocation[pi] == 'S':
            if given_string[pi] == 'o':
                swallocation.append(swallocation[pi - 1])
            else:
                swallocation.append(verse(swallocation[pi - 1]))
        else:
            if given_string[pi] == 'o':
                swallocation.append(verse(swallocation[pi - 1]))
            else:
                swallocation.append(swallocation[pi - 1])
    
    # verification
    if swallocation[0] == 'S':
        if given_string[0] == 'o':
            if swallocation[N - 1] != swallocation[1]:
                return -1
        else:
            if swallocation[N - 1] == swallocation[1]:
                return -1
    else:
        if given_string[0] == 'o':
            if swallocation[N - 1] == swallocation[1]:
                return -1
        else:
            if swallocation[N - 1] != swallocation[1]:
                return -1
    
    if swallocation[0] != swallocation[N]:
        return -1
    
    return ''.join(swallocation[:N])
  
def main():
    judge1 = sheep_wolf_allocator(s, "S", "S")
    judge2 = sheep_wolf_allocator(s ,"S", "W")
    judge3 = sheep_wolf_allocator(s ,"W", "S")
    judge4 = sheep_wolf_allocator(s ,"W", "W")
    
    if judge1 != -1:
        print(judge1)
        return
    
    if judge2 != -1:
        print(judge2)
        return
    
    if judge3 != -1:
        print(judge3)
        return
    
    if judge4 != -1:
        print(judge4)
        return
    
    print(-1)
    return
  
main()

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

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

    map<long long, long long> sums;
    long long count = 0;
    long long sum = 0;
    for(int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;

        sum += x;

        if(sum == 0) count++;

        count += sums[sum];
        sums[sum]++;
    }

    cout << count << endl;
}


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

typedef long long ll;

const int INF = 100000000;

int main() {
    int N;
    int ans = 0;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int x = i;
        int cnt = 0;
        while (x > 0) {
            cnt++;
            x /= 10;
        }
        if (cnt % 2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
bool c(ll a, ll b)
{
    return abs(a) > abs(b);
}
ll f(multiset <ll> &ms)
{
    ll ans = 1;
    for(auto x: ms)
    {
        ans = (ans * (x + mod) % mod) % mod;
    }
    return ans;
}
vll a;
int main()
{
    // ios_base :: sync_with_stdio(false);
    // cin.tie(NULL), cout.tie(NULL);
    ll n, i, k, ans;
    multiset <ll> ms;
    cin >> n >> k;
    a.resize(n);
    for(i = 0; i < n; i++)
        cin >> a[i];
    sort(all(a), c);
    if(k == n)
    {
        for(i = 0; i < n; i++)
        {
            ms.insert(a[i]);
        }
        cout << f(ms) << endl;
        return 0;
    }
    for(i = 0; i < n; i++)
        if(a[i] >= 0)
            break;
    if(i == n)
    {
        for(i = 0; i < k && k % 2 == 0; i++)
            ms.insert(a[i]);
        for(i = n - 1; i >= n - k && k % 2; i--)
            ms.insert(a[i]);
        ans = f(ms);
        cout << ans << endl;
        return 0;
    }
    ll neg = 0;
    ans = LLONG_MAX;
    for(i = 0; i < k; i++)
        ms.insert(a[i]), neg += (a[i] < 0 ? 1 : 0);
    if(neg % 2)
    {
        ll x1, y1, y = LLONG_MAX;
        x1 = y1 = y;
        for(i = k; i < n; i++)
            if(a[i] >= 0 && y1 == y)
                y1 = a[i];
        for(i = k - 1; i >= 0; i--)
            if(a[i] < 0 && x1 == y)
                x1 = a[i];
        if(x1 != y && y1 != y)
        {
            // cout << "ere\n";
            ms.insert(y1);
            ms.erase(ms.find(x1));
            ans = f(ms);
            ms.insert(x1);
            ms.erase(ms.find(y1));
        }
        ll x2 = y, y2 = y;
        for(i = k; i < n; i++)
            if(a[i] < 0 && y2 == y)
                y2 = a[i];
        for(i = k - 1; i >= 0; i--)
            if(a[i] >= 0 && x2 == y)
                x2 = a[i];
        if(ans == LLONG_MAX)
        {
            // cout << f(ms) << " ans" << endl;
            ms.insert(y2);
            ms.erase(ms.find(x2));
            ans = f(ms);
        }
        else
        {
            for(i = 0; i < k; i++)
            {
                if(a[i] == 0)
                {
                    // cout << "hey\n";
                    break;
                }
            }
            if(x2 != y && y2 != y && abs(x1 * y2) >= abs(x2 * y1))
            {
                // cout << "Here " << x2 << endl;
                ms.insert(y2);
                ms.erase(ms.find(x2));
                ans = f(ms);
            }
        }
    }
    else
        ans = f(ms);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14280
#include <stdio.h>

using namespace std;

int calcLimit(int n){
	int limit;
	for(limit=0;limit*limit<=n;limit++);
	return limit-1;
}

int main(){
	int n,count,limit;

	while(scanf("%d",&n)!=EOF){
		count=0;
		int* array = new int[n+1];
		for(int i=1;i<=n;i++)array[i]=0;
		limit = calcLimit(n);
		for(int i=2;i<=limit;i++){
			if(array[i] == 0)
			{
				for(int j=2*i;j<=n;j+=i){
					if(array[j]==0){
						array[j]=1;
						count++;
					}
				}
			}
		}
		printf("%d\n",n-(count+1));
	}

    return 0;
}

Measured memory_bytes: 59516
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n;
    cin >> n;
    cout << setprecision(16) << (double)(n-n/2) / (double)n << endl; 
}

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

int n,x;
bool ok=true;

int main()
{
	cin>>n;
	while(n--)
	{
		cin>>x;
		if(x%2==1 or x%3==0 or x%5==0) continue;
		ok=false;
	}

	if(ok) cout<<"APPROVED";
	else cout<<"DENIED";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();

int main(){
    pair<int,int> sc;
    ll N,M;
    cin >> N >> M;
    int s[M],c[M];
    int A[N];
    REP(i,N) A[i] = 0; 
    if(N>1){
        A[0] = 1;
    }
    REP(i,M){
        cin >> s[i] >> c[i]; 
    }
    REP(i,M){
        REP(j,M){
            if(s[i]==s[j]&&c[i]!=c[j]){
                cout << "-1" << endl;
                return 0;
            }
        }
    }
    REP(i,N){
        REP(j,M){
            if(i+1 == s[j]){
                A[i] = c[j];
            }
        }
    }
    ll ans =0;
    REP(i,N){
        ans *= 10;
        ans +=A[i];  
    }
    if(ans < pow(10,N-1)-1) cout << "-1" << endl;
    else cout << ans << endl;
    return 0;
     
    
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> Vector;
typedef vector<vector<ll>> DVector;

#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX/3
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define ub(x,y)     upper_bound(all(x),y)
#define lb(x,y)     lower_bound(all(x),y)
#define uni(x)      x.erase(unique(all(x)),x.end())
#define rep(i,n)    repl(i,0,n-1)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<int>())
#define mkp(x,y)    make_pair(x,y)
DVector tree;
int goal;
bool dfs(int parent,int current,int count) {
  if(count==3)return false;
  else if(current == goal)return true;
  else {
    bool flag = false;
    each(itr,tree[current]) {
      if(parent == itr)continue;
      if(dfs(current,itr,count+1))flag = true;
    }
    return flag;
  }
}
int main(){
  cin.sync_with_stdio(false);
  int n,m;
  cin >> n >> m;
  tree.resize(n);
  goal = n-1;
  int a,b;
  rep(i,m) {
    cin >> a >> b;
    tree[a-1].pb(b-1);
  }
  bool flag = false;
  int parent = -1;
  bool ans = dfs(parent,0,0);
  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 8960
#include<stdio.h>
int max(int a,int b){return a > b?a:b;}
int main(){
    int n;
    scanf("%d",&n);
    int a[n], b[n], c[n];
    for(int i = 0; i < n; i++)
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    int dp[n + 2][3];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 1; i < n; i++){
        dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
        dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
        dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
    }
    printf("%d\n",max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])));
    return 0;
}

Measured memory_bytes: 2560
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define M 1000000007
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll dp[200005]={0};
int main()
{
  ll n;
  cin>>n;
  ll a[n];
  std::map<ll,ll> mp;
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
    mp.insert(pair<ll,ll>(a[i],mp[a[i]]++));
  }
  ll sum=0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) { 
            sum+=ncr(itr->second,2);
        }
   ll b[n]={0};
  for (int i = 0; i < n; ++i)
  {
      ll mid=sum;
      mid=mid-ncr(mp[a[i]],2);
      b[i]=mid+ncr(mp[a[i]]-1,2);
  }
  for (int i = 0; i < n; ++i)
  {
    cout<<b[i]<<endl;
  }
   
  

}

Measured memory_bytes: 12672
N = int(input())
now = [0] * 2
prev_t = 0

for i in range(N):
    t,x,y = map(int, input().split())
    distance = abs(x-now[0]) + abs(y-now[1])
    if distance <= t - prev_t and (t - prev_t - distance)%2 == 0:
        now = [x,y]
        prev_t = t
    else:
        print('No')
        exit(0)

print('Yes')

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll X,Y,Z,K;
ll A[3001],B[3001],C[3001];

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

  cin>>X>>Y>>Z>>K;

  rep(i,X)cin>>A[i];
  rep(i,Y)cin>>B[i];
  rep(i,Z)cin>>C[i];

  vector<ll> crt;
  rep(i,X){
    rep(j,Y){
      crt.push_back(A[i]+B[j]);
    }
  }
  sort(all(crt)); reverse(all(crt));

  while((int)crt.size()>K){
    crt.pop_back();
  }

  vector<ll> res;
  rep(i,min(K,X*Y)){
    rep(j,Z){
      res.push_back(crt[i]+C[j]);
    }
  }
  sort(all(res)); reverse(all(res));

  rep(i,K)cout<<res[i]<<endl;

  return 0;
}


Measured memory_bytes: 43364
using System;
using System.IO;
using System.Linq;

class Solve
{
    static void Main(string[] args) {
        var N = int.Parse(Console.ReadLine());
        var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var dp = Enumerable.Repeat(int.MaxValue, N).ToArray();
        dp[0] = 0;
        dp[1] = Math.Abs(h[1] - h[0]);
        for (int i = 2; i < N; i++) {
            dp[i] = Math.Min(dp[i - 1] + Math.Abs(h[i] - h[i - 1]), dp[i - 2] + Math.Abs(h[i] - h[i - 2]));
        }
        var answer = dp[^1];
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 35580
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        
        if (Math.abs(a-c) <= d || (Math.abs(a-b) <= d && Math.abs(b-c) <= d)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
// Aizu Vol0 0050 Apple and Peach
// 2017.8.3

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

char *gets(char *);

#define MAX 1000

int main()
{
	char buf[MAX + 10], *p;

	gets(p = buf);
	while (*p) {
		while (*p && *p != 'a' && *p != 'p') *p++;
		if (!*p) break;
		if (*p == 'a') {
			if (!memcmp(p, "apple", 5)) memcpy(p, "peach", 5), p += 4;
		} else {
			if (!memcmp(p, "peach", 5)) memcpy(p, "apple", 5), p += 4;
		}
		p++;
	}
	puts(buf);
	return 0;
}

Measured memory_bytes: 524
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,m = inm()
a = inl()
sm = sum(a)
x = n - sm
if x>=0:
    print(x)
else:
    print(-1)


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

int main() {
    long long N;
    cin >> N;
    long long K = 1;
    while (K * (K + 1) / 2 < N) ++K;
    long long sub = K * (K + 1) / 2 - N;
    for (int i = 1; i <= K; ++i) {
        if (i == sub) continue;
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<int> D;
void input(){
    fast_io();
    cin >> N;
    D = fetch_vec<int>(N);
}

int diff_time(int a, int b){
    int ret = abs(a-b);
    int d = 24-a-b;
    ret = max(ret,min(d,24-d));
    return ret;
}

int solve(){
    map<int,int> cnt;
    for(auto d:D) cnt[d]++;
    int ans = 0;
    vector<int> time,timeD;;
    for(auto p:cnt){
        if(p.second==1) time.push_back(p.first);
        else if(p.second==2){
            if(p.first==0){
                cout << 0 << endl;
                return 0;
            }
            timeD.push_back(p.first);
            timeD.push_back(24-p.first);
        }
        else if(p.second>=3){
            cout << 0 << endl;
            return 0;
        }        
    }
    int T = time.size();
        for (int bit = 0; bit < (1<<T); bit++)
        {
            vector<int> time_mod;
            for (int i = 0; i < T; i++)
            {
                if((bit>>i)&1) time_mod.push_back(24-time[i]);
                else time_mod.push_back(time[i]);
            }
            int tmp_ans = 24;
            for(auto timed:timeD) time_mod.push_back(timed);
            for (int i = 0; i < (int)time_mod.size(); i++)
            {
                for (int j = i+1; j < (int)time_mod.size(); j++)
                {
                    int d = abs(time_mod[i]-time_mod[j]);
                    tmp_ans = min(tmp_ans,min(d,24-d));
                }
                
            }
            for(auto d:D) tmp_ans=min(tmp_ans,d);
            DBG(tmp_ans)
            ans = max(ans,tmp_ans);
        }
    
    cout << ans << endl;
    return 0;
}   

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

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>

const int upper_bound_length = 2000;
std::string a, b, c;
int length_a, length_b, length_c;
int min_length_s = 3*upper_bound_length;

// i-j+50000 element(0-based) means that assignment where a[i] and b[j] are match is contradict.
bool ab[100000], bc[100000], ac[100000];

bool match(char c1, char c2) {
  return (c1 == '?' || c2 == '?' || c1 == c2);
}

int main() {
  std::cin >> a >> b >> c;
  length_a = a.length();
  length_b = b.length();
  length_c = c.length();
  for (int i = 0; i < length_a; ++i) {
    for (int j = 0; j < length_b; ++j) {
      if (!match(a[i], b[j])) ab[i-j+50000] = true;
    }
  }
  for (int i = 0; i < length_b; ++i) {
    for (int j = 0; j < length_c; ++j) {
      if (!match(b[i], c[j])) bc[i-j+50000] = true;
    }
  }
  for (int i = 0; i < length_a; ++i) {
    for (int j = 0; j < length_c; ++j) {
      if (!match(a[i], c[j])) ac[i-j+50000] = true;
    }
  }
  for (int i = -2*upper_bound_length; i <= 2*upper_bound_length; ++i) {
    for (int j = -2*upper_bound_length; j <= 2*upper_bound_length; ++j) {
      if (!ab[i+50000] && !bc[j-i+50000] && !ac[j+50000]) {
        int L = std::min(0, std::min(i, j));
        int R = std::max(length_a, std::max(length_b + i, length_c + j));
        min_length_s = std::min(min_length_s, R - L);
      }
    }
  }

  std::cout << min_length_s << std::endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

n=II()
aa=[1000]+LI()
m=1000
k=0
up=False
for i in range(1,n+1):
    if up and aa[i-1]>aa[i]:
        m+=k*aa[i-1]
        k=0
        up=False
    elif up==False and aa[i-1]<aa[i]:
        k+=m//aa[i-1]
        m-=aa[i-1]*k
        up=True
    #print(i,m,k)
m+=aa[-1]*k
print(m)


Measured memory_bytes: 9236
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<=y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
char s[100005];
int main()
{
	cin>>s;
	int len=strlen(s);
	for(int i=0;i<len;i+=2)
	{
		cout<<s[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

constexpr char digits[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

int main() {
  int64_t N;
  cin >> N;
  string result = "";
  while (N != 0) {
    --N;
    result += digits[N % 26];
    N /= 26;
  }
  reverse(result.begin(), result.end());
  cout << result << endl;
  
  return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String T = sc.next();
	StringBuilder sb = new StringBuilder();
	for(int i=0;i<T.length();i++){
	    if(T.charAt(i) == '?')
		sb.append('D');
	    else
		sb.append(T.charAt(i));
	}
	System.out.print(sb.toString());
    }
}


Measured memory_bytes: 41452
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  long double r;
  cin >> r;
  long double ans = r * (long double)2 * 3.14159265358979323846;
  cout << std::fixed << std::setprecision(20) << ans << endl;
}

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

void call(int n){
  for(int i=1;i<=n;i++){
    int x=i;
    if(x%3==0){
      cout<<" "<<x; continue;
    }
    while(x!=0){
      if(x%10==3){
        cout<<" "<<i; break;
      }
      x/=10;
    }
  }

}
int main(){
  int n;
  cin>>n;
  call(n);
  cout<<"\n";
}

Measured memory_bytes: 3112
#include <iostream>

using namespace std;

int h[100001];
int dp[100001];

int main() {
	int N;
	cin >> N;
	for (int i = 1; i <= N; ++i) cin >> h[i];
	dp[1] = 0;
	for (int i = 2; i <= N; ++i) {
		dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
		if (i >= 3) {
			dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
		}
	}
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define fastAF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define int ll
#define ull unsigned ll
#define ld long double
#define pb push_back
#define pf push_front
#define dll deque<ll>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mapll map<ll,ll>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ms(a,x) memset(a,x,sizeof(a))
using namespace std;
void swap(auto*,auto*);
const ll N=1e6; 
    ll sieve[N+1];  pll mainHash[N+1];
int32_t main()
{
    fastAF
    ms(sieve,0);
    for(ll i=1;i<=N;i++) sieve[i]=i;
    for(ll i=2;i*i<=N;i++)
    {
    	if(sieve[i]==i)
    	{
    		for(ll j=i*i;j<=N;j+=i)
    		{
    			if(sieve[j]==j)
    			{
    				sieve[j]=i;
    			}
    		}
    	}
    }
    ll n; cin>>n; ll a[n]; for(ll i=0;i<n;i++) cin>>a[i];
    ll g=a[0];
    for(ll i=1;i<n;i++){
    	g=__gcd(g,a[i]);
    }
    if(g!=1){
    	cout<<"not coprime"; return 0;
    }
    for(ll i=1;i<=N;i++)
    {
    	mainHash[i]={0,-1};
    }
    bool flag=0;
    for(ll i=0;i<n;i++)
    {
   		ll x=a[i];
   		if(x==1) continue;
   		while(sieve[x]!=x)
   		{
   			if(mainHash[sieve[x]].first==1)
   			{
   				if(mainHash[sieve[x]].second!=i) {flag=1; break;}
   			}
   			else
   			{
   				mainHash[sieve[x]].first=1; mainHash[sieve[x]].second=i;
   			}
   			x/=sieve[x];
   		}
   		if(flag) break;
   		if(x!=1)
   		{
   			if(mainHash[sieve[x]].first==1)
   			{
   				if(mainHash[sieve[x]].second!=i) {flag=1; break;}
   			}
   			else
   			{
   				mainHash[sieve[x]].first=1; mainHash[sieve[x]].second=i;
   			}
   		}
   		if(flag) break;
    }
    if(flag) cout<<"setwise coprime"; else cout<<"pairwise coprime";
    return 0;
}
void swap(auto &a,auto &b)
{
    auto temp=a; a=b; b=temp;
}

Measured memory_bytes: 34824
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    n, m = LI()
    if n == m:
        print("Yes")
    else:
        print("No")

    return


# B
def B():
    a, b = LI()
    if a <= b:
        ans = str(a) * b
    else:
        ans = str(b) * a
    print(ans)
    return


# C
def C():
    n = I()
    p = LI()
    n_min = n + 1
    ans = 0
    for num in p:
        if num < n_min:
            ans += 1
            n_min = num
    print(ans)
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 70608
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char c[10010];
int main()
{
	cin>>c;
	for(int i=0;i<strlen(c);i++)
	  if(c[i]=='C')
	  	for(int j=i+1;j<=strlen(c);j++)
	  	  if(c[j]=='F')
	  	  {
	  	  	cout<<"Yes"<<endl;
	  	  	return 0;
	  	  }
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
 
using namespace std;
const int N = 10;
const int M = 105;
const double INF = 0x3f3f3f3f;
 
int n, v[N], t[M];
double R, w[N], ans, l[M], r[M], val[M];
 
void init () {
	memset(t, 0, sizeof(t));
	memset(v, 0, sizeof(v));
	t[1] = -1; ans = -1;
 
	scanf("%lf%d", &R, &n);
	for (int i = 1; i <= n; i++) scanf("%lf", &w[i]);
}
 
void judge(int u) {
	memset(l, 0, sizeof(l));
	memset(r, 0, sizeof(r));
	memset(val, 0, sizeof(val));
 
	for (int i = u; i; i--) {
		if (t[i] == -1) {
			int x = i*2, y = i*2+1;
			val[i] = val[x] + val[y];
			double Li = val[y] / val[i];
			double Ri = val[x] / val[i];
 
			l[i] = min(-Li+l[x], Ri+l[y]);
			r[i] = max(-Li+r[x], Ri+r[y]);
		} else if (t[i]) {
			val[i] = w[t[i]];
		}
	}
 
	double tmp = r[1] - l[1];
	if (tmp - R < 1e-5 && tmp > ans) ans = tmp;
}
 
void dfs(int u, int m, int use) {
 
	if (use == 0) {
		judge(u-1);
		return;
	}
 
	if (t[u/2] != -1)  {
		dfs(u+1, m, use);
	} else {
 
		if (use > m) {
			t[u] = -1;
			dfs(u+1, m+1, use);
			t[u] = 0;
		}
 
		if (m == 1 && use > 1) return;
 
		for (int i = 1; i <= n; i++) if (!v[i]) {
			v[i] = 1; t[u] = i;
			dfs(u+1, m-1, use-1);
			v[i] = 0; t[u] = 0;
		}
	}
}
 
int main () {
	int cas;
	scanf("%d", &cas);
	while (cas--) {
		init();
		if (n == 1) printf("%.10lf\n", 0.0);	
		else {
			dfs(2, 2, n);
			if (ans == -1) printf("-1\n");
			else printf("%.10lf\n", ans);
		}
	}
	return 0;
}


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

int main() {

  int n,br=0,ik=0,dr=0,x;
  scanf("%d",&n);
  for(int i=1;i<=n;i++) {
    scanf("%d",&x);
    if(x%4==0) dr++;
    else if(x%2==0) ik++;
    else br++;
  }
  if(br>dr+1) {
    printf("No");
  }
  else if(br>dr) {
    if(!ik) {
      printf("Yes");
    }
    else {
      printf("No");
    }
  }
  else {
    printf("Yes");
  }

}


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

int main() {
  int n,a,b,c,d;
  
  cin >> n;
  a = n%10;//一桁目
  b = n/10%10;
  c = n/100%10;
  d = n/1000;//四桁目
  
  if ((a==b && b==c) || (b==c && c==d))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[101];
int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int N,M;
    cin>>N>>M;
    int sum=0;
    for(int i=0;i<N;i++){
        cin>>a[i];
        sum+=a[i];
    }
    double v=double(sum)/double(4*M);
    int cnt=0;
    for(int i=0;i<N;i++){
        if(a[i]>=v)
            cnt++;
    }

    if(cnt>=M)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
long N;
long ans=15;
long k,ik;
int main(){
  cin>>N;
  for(long i=1;i<=sqrt(N);i++){
    if(N%i==0){
      k=N/i;
      ik=log10(i)+1;
      k=log10(k)+1;
      long h;
      h=max(ik,k);
      if(ans>h) {
        ans=h;
      }
    }
  //  cout<<"i="<<i<<" ended!"<<endl;
  }
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 512
MOD = 1000000007
import sys
x, y = map(int, input().split())

if (2*x-y)%3!=0 or (2*x-y)<0 or (2*y-x)%3!=0 or (2*y-x)<0:
  print(0)
  sys.exit()
  
a = (2*x-y)//3
b = (2*y-x)//3

#nCr n*(n-1)*...*(n-r+1)/(r*(r-1)*...*1)

def pow_k(x, n, MOD):
  if n==0:
    return 1
  res = 1
  while n:
    if n&1:
      res = res*x%MOD
    x = x*x%MOD
    n = n>>1
  return res

def comb(n, r, MOD):
  numerator = 1
  denominator = 1
  
  for i in range(r):
    numerator = numerator * (n-i) % MOD
    
  inv = [1]*r
  for i in range(r):
    inv[i] = pow_k(i+1, MOD-2, MOD)
  
  for i in range(r):
    denominator = denominator * inv[i]%MOD
  
  return numerator*denominator%MOD

if a<b:
  a, b = b, a
  
print(comb(a+b, b, MOD))

Measured memory_bytes: 43756
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);
 
int main(){
    IOS;
   ll h,a;cin>>h>>a;
   cout<<h/a+(h%a!=0);
    return 0;
}   


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(ll i=0;i<N;++i)
const ll INF = 1LL<<60;

int main(){
    ll s; cin >> s;
    ll a,b,c,d;
    a = 1e9; b = 1;
    // s = a * d - c
    d = ceil((long double)s/(double)a), c = a * d - s;
    cout << "0 0 " << a << " " << b << " " << c << " " << d << endl;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(string, "s", long, "p");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    long n, m;
    scan(n, m);
    auto a = aryread();
    auto s = a.sum();
    long cnt;
    foreach (e; a)
    {
        if (4 * m * e >= s)
            cnt++;
    }
    if (cnt >= m)
        writeln("Yes");
    else
        writeln("No");
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 2688
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

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

    sort(x, x+3);

    int dx1 = max(x[2]-x[1], x[2]-x[0]);
    int dx2 = min(x[2]-x[1], x[2]-x[0]);

    int ans = 0;

    ans += dx2;
    dx1 -= dx2;
    dx2  = 0;

    if(dx1 % 2 == 1){
        dx1 += 1;
        ans += 1;
    }

    ans += dx1/2;

    cout << ans;

    return 0;
}

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




int main(void) {
  int p;
  cin >> p;
  int a[4];
  rep(i,4){
    a[i] = p%10;
    p /=10;
  }
  int l = -1;
  rep(tmp,1<<3){
    bitset<3> s(tmp);
    int sum = a[3];
    rep(i,3){
      if(s.test(i)) sum += a[i];
      else sum -= a[i];
    }
    if(sum == 7) l = tmp;
  }
  bitset<3> ans(l);
  cout << a[3];
  rep(i,3){
    char plus = '-';
    if (ans.test(2-i)) plus = '+';
    cout << plus << a[2-i] ;
  }
  cout << "=7" << endl;
    
   
}

Measured memory_bytes: 256
#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>;

const ll INF = 1001001001;

int main()
{
    int n;
    string s, t;
    cin >> n;
    cin >> s;
    cin >> t;
    rep(i, n) {
        bool x = true;
        repl(j, i, n) {
            if(s[j] != t[j - i]) x = false;
        }
        if(x) {
            cout << 2 * n - (n - i) << endl;
            return 0;
        }
    }
    cout << 2 * n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vll vector<long long>
#define pll pair<long long, long long>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1e18
 

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;

const int N = 6e5 + 6;
ll lo[4 * N + 1], hi[4 * N + 1], delta[4 * N + 1], mini[4 * N + 1];

// change update and rmq according to question

void buildSeg(ll node, ll l, ll r)
{
  lo[node]=l;
  hi[node]=r;
  if (l == r)
  {
    return;
  }
  ll mid = l+(r-l)/2;
  buildSeg(2*node+1,l,mid);
  buildSeg(2*node+2,mid+1,r);
}

void prop(ll i)
{
  delta[2*i+1]+=delta[i];
  delta[2*i+2]+=delta[i];
  delta[i]=0;
}


void update(ll i)
{
  mini[i] = mini[2*i+1]+delta[2*i+1]+mini[2*i+2]+delta[2*i+2];
}

void increment(ll i,ll l,ll r,ll val)
{
   if(r<lo[i]||l>hi[i])
   {
      return;
   }
   if(l<=lo[i]&&r>=hi[i])
   {
     delta[i]+=val;
     return;
   }
   prop(i);

   increment(2*i+1,l,r,val);
   increment(2*i+2,l,r,val);
   update(i);
}

ll rmq(ll i,ll l,ll r)
{
   if(r<lo[i]||l>hi[i])
   {
     return 0;
   }
   if(l<=lo[i]&&r>=hi[i])
   {
     return (mini[i]+delta[i]);
   }
   prop(i);
   ll lefmin=rmq(2*i+1,l,r);
   ll rigmin=rmq(2*i+2,l,r);
   update(i);
   return lefmin+rigmin;
}

void solve()
{
    ll n,q;
    cin>>n>>q;
    ll i,j;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    array<ll,3> op[q];
    for(i=0;i<q;i++)
    {
        cin>>op[i][1]>>op[i][0];
        // op[i][1]--;
        // op[i][0]--;
        op[i][2]=i;
    }
    sort(op,op+q);
    buildSeg(1,1,n);
    ll last[n+1];
    ll ans[q];
    clr(ans);
    ll qq=0;
    for(i=0;i<=n;i++)
    {
        last[i]=-1;
    }
    for(i=0;i<n;i++)
    {
        if(last[a[i]]!=-1)
        {
            increment(1,last[a[i]]+1,last[a[i]]+1,-1);
        }
        last[a[i]]=i;
        increment(1,i+1,i+1,1);
        while(qq<q&&op[qq][0]==(i+1))
        {
            ans[op[qq][2]]=rmq(1,op[qq][1],op[qq][0]);
            qq++;
        }
    }
    for(i=0;i<q;i++)
    {
        cout<<ans[i]<<"\n";
    }


}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

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

int main() {
	string s; cin >> s;
	for (int i = 2; i < s.size(); i+=2) {
		string tmp = s.substr(0, s.size() - i);
		string l = tmp.substr(0, (int)(tmp.size() / 2));
		string r = tmp.substr((int)(tmp.size() / 2));
		if (l == r) {
			cout << tmp.size() << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
a,b,c,d,e,f = map(int, input().split())
sugar = []
for i in range(1501):
    if (i%c==0):
        sugar.append(i)
    else:
        for j in range(i//c+1):
            if (i-j*c)%d==0:
                sugar.append(i)
#print(sugar)
ans = 0
ax = 100*a
ay = 0
for i in range(30):
    for j in range(30):
        if (i==0 and j==0):
            continue
        if (a*i+b*j <= f//100):
            w = (a*i+b*j)*100
            for k in sugar:
                if ((100*k)/(w+k)<=(100*e)/(100+e) and (w+k)<=f):
                    if ((100*k)/(w+k) > ans):
                        
                        ans = 100*k/(w+k)
                        #print(w,k,ans)
                        ax = w
                        ay = k
print(ax+ay,ay)

            

Measured memory_bytes: 9216
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        String w = scan.next();

        int count = 0;

        while(true) {
            String t = scan.next();
            if(t.equals("END_OF_TEXT")) {
                break;
            }

            if(t.toLowerCase().equals(w)) {
                count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 26308
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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() {
    ll n;
    cin >> n;
    map<char,int> ma;
    rep(i,n){
        char in;
        cin >> in;
        ma[in]++;
    }
    if(ma.size() == 3)cout << "Three\n";
    else cout << "Four\n";
    return 0;
}

Measured memory_bytes: 256
n = int(input())
combiList = {}
sum_cnt = 0

for _ in range(n):
    act_string = sorted(input())
    act_string = "".join(act_string)
    cnt = combiList.get(act_string)
    if cnt is None:
        combiList[act_string] = 1
    else:
        combiList[act_string] += 1
        sum_cnt += cnt

print(int(sum_cnt))

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

using namespace std;

int main() {
	string in;
	cin >> in;
	
	int l = 0;
	int max_len = 0;
	
	for(int i = 0; i < in.length(); i++) {
		if(in[i] != 'A' && in[i] != 'C' && in[i] != 'T' && in[i] != 'G') l = i+1;
		max_len = max(max_len, i - l + 1);
	}
	
	cout << max_len;
	
	return 0;
}

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

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
/*-------------------------------------------------*/
template <typename T>
T lcs(const T &seq1, const T &seq2) {
  const int seq1_sz = seq1.size(), seq2_sz = seq2.size();
  vector<vector<int> > dp(seq1_sz + 1, vector<int>(seq2_sz + 1, 0));
  REP(i, seq1_sz) REP(j, seq2_sz) {
    if (seq1[i] == seq2[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
    else dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
  }
  T res;
  int i = seq1_sz, j = seq2_sz;
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j]) --i;
    else if (dp[i][j] == dp[i][j - 1]) --j;
    else {
      res.push_back(seq1[i - 1]);
      --i;
      --j;
    }
  }
  reverse(ALL(res));
  return res;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s, t; cin >> s >> t;
  cout << lcs(s, t) << '\n';
  return 0;
}


Measured memory_bytes: 35584
#include<stdio.h>
int main(){
  int flag = 1;
  int i,tmp,N,count=0;
  int A[100];

  scanf("%d",&N);
 
  for( i=0 ; i<N ; i++ ){
    scanf("%d",&A[i]);
  }
  
  while(flag){
    flag = 0;
    for( i=N-1 ; i>0 ; i-- ){
      if(A[i] < A[i-1]){
	tmp = A[i];
	A[i] = A[i-1];
	A[i-1] = tmp;
	count++;
  	flag = 1;
      }
    }
  }

  for( i=0 ; i<N-1 ; i++)
    printf("%d ",A[i]);

  printf("%d",A[N-1]);
  printf("\n%d\n",count);
    
  return 0;
}



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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> b(N);
    for(int i = 0; i < N; i++)
        cin >> b[i];
    stack<int> seq;
    while(true)
    {
        int i;
        for(i = b.size() - 1; i >= 0; i--)
            if(b[i] == i + 1)
                break;
        if(i == -1)
            break;
        b.erase(b.begin() + i);
        seq.push(i + 1);
    }
    if(b.size() > 0)
        cout << "-1";
    else
    {
        while(!seq.empty())
        {
            cout << seq.top() << "\n";
            seq.pop();
        }
    }
    
    // system("PAUSE");
    return 0;
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;


#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

	int A, B; cin >> A >> B;
	A--; B--;
	cout << (B+A-1)/A << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long money = 100000;
void up() {
    int judge = money % 1000;
    //cout << judge << endl;
    if(judge) {
        money -= judge; money += 1000;
    }
}

int main(void) {
    int n; cin >> n;
    for(int r = 0; r < n; r++) {
        money *= 1.05; up();
    }
    cout << money << endl;
    return(0);
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#define MAX 1000000

typedef struct task
{
	char name[100];
	int time;
} task;

int head,tail;
task S[MAX];

int isEmpty()
{
	return head==tail;
}

int isFull()
{
	return head==(tail+1)%MAX;
}

void enqueue(task x)
{
	if(isFull())
	{
		printf("ERROR!The number is so big");
	}
	else
	{
		S[tail]=x;
		tail=(tail+1)%MAX;
	}
}

task dequeue()
{
	if(isEmpty())
	{
		printf("Soory,the queue has already been empty.");
	}
	else
	{
		task x=S[head];
		head=(head+1)%MAX;
		return x;
	}
}

int main()
{
	task input;
	head=tail=0;
	int i,j,n,q,t=0;
	scanf("%d%d",&n,&q);
	for(i=0; i<n; i++)
	{
		scanf("%s",input.name);
		scanf("%d",&input.time);
		enqueue(input);
	}
	while(!isEmpty())
	{
		input=dequeue();
		if((input.time=input.time-q)>0)
		{
			enqueue(input);
			t+=q;
		}
		else
		{
			t+=input.time+q;
			printf("%s %d\n",input.name,t);
		}
	}
	return 0;
}


Measured memory_bytes: 21848
use std::io;

fn main() {
    let s = parse_line::<String>();
    let count_a = s.chars().filter(|&item| item == 'A').count();
    if count_a == 0 || count_a == 3 {
        println!("No");
    } else {
        println!("Yes");
    }
}

/// Parse line from io::stdin into T Value
fn parse_line<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 4352