akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC126
{
    class B
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int s1 = int.Parse(S.Substring(0, 2));
            int s2 = int.Parse(S.Substring(2, 2));

            string result = "";
            if(s1>=01 && s1 <= 12)
            {
                if(s2>=01 && s2 <= 12)
                {
                    result = "AMBIGUOUS";
                }
                else
                {
                    result = "MMYY";
                }
            }
            else
            {
                if (s2 >= 01 && s2 <= 12)
                {
                    result = "YYMM";
                }
                else
                {
                    result = "NA";
                }

            }

            Console.WriteLine(result);
        }

    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ld long double
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

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

// デバッグを消し忘れるな！！！


ll gcd(ll a, ll b){
    while(1){
        if(a < b) swap(a, b);
        if(!b) break;
        a %= b;
    }
    return a;
}

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

int main() {
    ll n; cin >> n;
    Vl t(n);
    rep(i, 0, n) cin >> t[i];

    ll ans = t[0];
    rep(i, 1, n){
        ans = lcm(ans, t[i]);
    }
    co(ans);

    return 0;
}


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

int main(){
  int x; cin >> x;
  int l; cin >> l;
  int count;
  for (int i; i < x; i++){
    int a; cin >> a;
    if (a < l-a) count += a;
    else count += l-a;
  }
  cout << count*2 << endl;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

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

  int a, b;
  cin >> a >> b;
  cout << (a-1)*(b-1) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
    int n, m;
    Set<Integer> oneLines;
    Set<Integer> nLines;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        m = sc.nextInt();
        oneLines = new HashSet<>();
        nLines = new HashSet<>();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == 1) {
                oneLines.add(b);
            }
            if (b == n) {
                nLines.add(a);
            }
        }
        solve();
    }

    void solve() {
        for (int i : oneLines) {
            if (nLines.contains(i)) {
                System.out.println("POSSIBLE");
                return;
            }
        }
        System.out.println("IMPOSSIBLE");
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 58540
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < (n);++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0)

const ll INF = 1e9+7;

// 各桁の和
template<typename T>T digit(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;}
template<typename T>T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

struct tree{
public:
  tree* par;
  vector<tree*> chi;
  int cnt;
};

void tre(tree* t,int x){
  t->cnt += x;
  rep(i,t->chi.size()){
    tre(t->chi[i],t->cnt);
  }
}

int main() {
  int n,q;cin>>n>>q;
  int a,b,p,x;
  vector<tree> t(n);
  rep(i,n-1){
    cin>>a>>b;
    t[--a].chi.pb(&t[--b]);
    t[b].par = &t[a];
  }
  
  rep(i,q){
    cin>>p>>x;
    t[--p].cnt += x;
  }
  tre(&t[0],0);
  rep(i,n)
    printf("%d ",t[i].cnt);
    
  
  return 0;
}

Measured memory_bytes: 22656
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d)
        cout<<"Left"<<endl;
    if(a+b==c+d)
        cout<<"Balanced"<<endl;
    if(a+b<c+d)
        cout<<"Right"<<endl;
    return 0;
}

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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    //cout << setprecision(15);
    ll n;
    cin >> n;
    map<string, priority_queue<pll>> m;
    FOR(i, n)
    {
        string x; ll y;
        cin >> x >> y;
        if (m.find(x) == m.end())
        {
            priority_queue<pll> q;
            m[x] = q;
        }
        m[x].push(make_pair(y, i + 1));
    }
    FORE(i, m)
    {
        while (!i.se.empty())
        {
            cout << i.se.top().se << '\n';
            i.se.pop();
        }
    }
}



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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	vector<long> m(5);
	for( int i = 0; i < N; ++i ) {
		string s;
		cin >> s;

		if( s[0] == 'M' ) { m[0] += 1; }
		else if( s[0] == 'A' ) { m[1] += 1; }
		else if( s[0] == 'R' ) { m[2] += 1; }
		else if( s[0] == 'C' ) { m[3] += 1; }
		else if( s[0] == 'H' ) { m[4] += 1; }
	}

	long ans = 0;
	for( int i = 0; i < 5-2; ++i ) {
		for( int j = i+1; j < 5-1; ++j ) {
			for( int k = j+1; k < 5; ++k ) {
				ans += m[i] * m[j] * m[k];
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int n;
	cin >> n;
	map<string, int> string_cnt;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		string_cnt[s]++;
	}
	int mx = 0;
	for (auto mp : string_cnt) mx = max(mx, mp.second);
	for (auto mp : string_cnt) {
		if (mp.second == mx) cout << mp.first << endl;
	}
	return 0;
}

Measured memory_bytes: 19240
package main

import (
	"fmt"
	"strings"
)

func main() {
	a := ""
	fmt.Scan(&a)
	arr := strings.Split(a, "")

	count := 0
	store := 0

	for _, s := range arr {
		if s == "A" || s == "C" || s == "G" || s == "T" {
			count += 1
			if count > store {
				store = count
			}
		} else {
			count = 0
		}
	}

	fmt.Println(store)
}


Measured memory_bytes: 640
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

void solve(){
    int n; cin>>n;
    vector<int> a(n,0), b(n,0), c(n,0), d;
    f(i,n) cin>>a[i];
    f(i,n) cin>>b[i];
    f(i,n) c[i] = i+1;
    d = c;
    int x = 0, y = 0;
    do{
    	if(c == a) break;
    	else x++;
	}while(next_permutation(all(c)));
	do{
    	if(d == b) break;
    	else y++;
	}while(next_permutation(all(d)));
	int ans = abs(x - y);
	cout<<ans<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

long long loop(ll h){
	if(h>1){
		return 2*loop(h/2)+1;
	}
	else{
		return 1;
	}
}

int main()
{
	ll h,cnt;
	cin >> h;
	cnt=loop(h);
	cout << cnt << endl;
	return 0;
}


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

int main() {
  string s,t;
  cin>>s>>t;
  int ns=s.size(),nt=t.size();
  for(int i=ns-nt;i>=0;i--){
    string x=s.substr(i,nt);
    //cout<<x<<endl;
    bool flg=true;
    for(int j=0;j<nt;j++){
      //cout<<x<<t<<endl;
      if(x[j]!=t[j]&&x[j]!='?'){
        flg=false;
        break;
      }

    }
    if(flg){
      //cout<<x<<endl;
      for(int k=0;k<nt;k++){
        s[i+k]=t[k];
      }
      for(int k=0;k<ns;k++){
        if(s[k]=='?') cout<<'a';
        else cout<<s[k];
      }
      cout<<endl;
      return 0;
    }
  }
cout<<"UNRESTORABLE"<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var buttons = new List<int>();
		for (var i = 0; i < n; ++i) {
			buttons.Add(int.Parse(Console.ReadLine()) - 1);
		}

		var pushedButtons = new HashSet<int>();
		var index = 0;
		var count = 0;
		while (true) {
			++count;
			var nextIndex = buttons[index];
			if (nextIndex == 1) {
				break;
			}

			if (pushedButtons.Contains(nextIndex)) {
				count = -1;
				break;
			}

			pushedButtons.Add(index);
			index = nextIndex;
		}

		Console.WriteLine(count);
	}
}


Measured memory_bytes: 35492
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Diagnostics;
using static System.Console;
using static System.Math;


namespace AtCoder
{
    class AtCoderrrrr
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var dic = new Dictionary<string, int>();
            for (int i = 0; i < n; i++)
            {
                string tmp = ReadLine();
                try
                {
                    dic.Add(tmp,1);
                }
                catch (Exception)
                {
                    dic[tmp]++;
                }
            }
            int m = int.Parse(ReadLine());
            for (int i = 0; i < m; i++)
            {
                string tmp = ReadLine();
                try
                {
                    dic.Add(tmp, -1);
                }
                catch (Exception)
                {
                    dic[tmp]--;
                }
            }
            WriteLine(
                Max(dic.Max(x => x.Value),0) 
                );

        }
    }
}


Measured memory_bytes: 11360
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

R = I()

print(2*math.pi*R)

Measured memory_bytes: 65440
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <regex>

#define rep(i, n) for(int i=0;i<(int)(n);i++)

using namespace std;

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 N, M;
int a[200010], b[200010];

int main() {
    cin >> N >> M;
    rep(i, M) cin >> a[i] >> b[i];

    map<string, bool> m;
    for (int i = 0; i < M; i++) {
        string key = to_string(a[i]) + '-' + to_string(b[i]);
        m[key] = true;
    }

    for (int i = 2; i < N; i++) {
        string lkey = "1-" + to_string(i);
        string rkey = to_string(i) + "-" + to_string(N);
        if (m[lkey] && m[rkey]) {
            cout << "POSSIBLE" << endl;
            exit(0);
        }
    }

    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 48640
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

//constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  char c;
  while (cin >> c) {
    if(c == '?') c = 'D';
    cout << c;
  }

  cout << endl;
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
int main(){ 
	int n;
	cin>>n;
	ll a[n],xo=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		xo^=a[i];	
	}
	for(int i=0;i<n;i++){
		a[i]=xo^a[i];	
	}
	for(int i=0;i<n;i++)cout<<a[i]<<" ";
}



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

int main(void) {
	string S, ans;

	cin >> S;
	ans = "TBD\n";
	int manth = (int)(S[5] - '0') * 10 + (int)(S[6] - '0');
	if (manth <= 4)
		ans = "Heisei\n";

	cout << ans;
	return 0;
}


Measured memory_bytes: 256
# include <stdio.h>
int main()
{
    double a,b,c,d;
    scanf("%lf",&a);
    b=3.1415926535897932384626433*a*a;
    c=2*3.1415926535897932384626433*a;
    printf("%.6lf %.6lf\n",b,c);
    return 0;
}


Measured memory_bytes: 2744
int main(){
    int n,y,i,j,k;
    scanf("%d%d",&n,&y);
    for(i=0;i<=n;i++)for(j=0;j<=n-i;j++){
        k=n-i-j;
        if(i*1000+j*5000+k*10000==y){
            printf("%d %d %d\n",k,j,i);
            return 0;
        }
    }
    puts("-1 -1 -1");
    return 0;
}


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

using namespace std;

int main()
{
   int n,tmp;
   cin>>n;
   int min1=200001,count1=0;

   for(int i=0;i<n;i++)
   {
       cin>>tmp;
       if(tmp<=min1)
       {
           count1++;
           min1=tmp;

       }

   }

   cout<<count1;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
    int n;
    long long k;
    cin>>n>>k;
    pair<int,int> ab[n];
    int a,b;
    rep(i,n){
        cin>>a>>b;
        ab[i] = make_pair(a,b);
    }

    sort(ab,ab+n);
    long long sum=0;
    rep(i,n){
        sum += ab[i].second;
        if(sum >= k){
            cout<<ab[i].first;
            return 0;
        }
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast() ios_base::sync_with_stdio(0),cin.tie(0)
int32_t main()
{double x,t;
 cin>>t>>x;
 cout<<fixed<<setprecision(6)<<t/x;
 return 0;
}





Measured memory_bytes: 256
//  Created by liszt on 2019/08/04.
#include<bits/stdc++.h>
using namespace std;

int main(){
    string s; cin>>s;
    int n=s.size();
    vector<int> ans(n,0);
    
    int chldrn=0;
    for(int i=0;i<n-1;i++){
        if(s[i]=='R'&&s[i+1]!='L'){
            chldrn++;
        }else if(s[i]=='R'&&s[i+1]=='L'){
            if(chldrn%2==0){
                ans[i]+=chldrn/2+1;
                ans[i+1]+=chldrn/2+1;
                chldrn=0;
            }else{
                ans[i]+=chldrn/2+1;
                ans[i+1]+=chldrn/2+2;
                chldrn=0;
            }
        }else{
            continue;
        }
    }
    
    chldrn=0;
    for(int i=n-1;i>0;i--){
        if(s[i]=='L'&&s[i-1]!='R'){
            chldrn++;
        }else if(s[i]=='L'&&s[i-1]=='R'){
            if(chldrn%2==0){
                ans[i]+=chldrn/2;
                ans[i-1]+=chldrn/2;
                chldrn=0;
            }else{
                ans[i]+=chldrn/2;
                ans[i-1]+=chldrn/2+1;
                chldrn=0;
            }
        }else{
            continue;
        }
    }
    
    for(int i=0;i<n;i++){
        cout<<ans[i];
        if(i!=n-1)cout<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int h,w;
    vector<string>g;
    cin >> h >> w;
    g.resize(h);
    rep(i, h)   cin >> g[i];
    vector<vector<int>>dp(h, vector<int>(w, 100000000));
    if(g[0][0] == '#')  dp[0][0] = 1;
    else                dp[0][0] = 0;
    for(int i = 1; i < w; i++){
        if(g[0][i-1] == '.' && g[0][i] == '#')  dp[0][i] = dp[0][i-1] + 1;
        else                                    dp[0][i] = dp[0][i-1];
    }
    for(int i = 1; i < h; i++){
        rep(j, w){
            if(g[i-1][j] == '.' && g[i][j] == '#')  dp[i][j] = dp[i-1][j] + 1;
            else                                    dp[i][j] = dp[i-1][j];
            if(j > 0){
                if(g[i][j-1] == '.' && g[i][j] == '#')  dp[i][j] = min(dp[i][j], dp[i][j-1] + 1);
                else                                    dp[i][j] = min(dp[i][j], dp[i][j-1]);
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 3692
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp32 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(st);

            int A = st[0];
            int B = st[1];
            int C = st[2];

            int remain = C * 2 - (A + B);

            if (remain % 2 == 0) {
                Console.WriteLine(remain / 2);
            } else {
                Console.WriteLine((remain + 3) / 2);
            }

        }
    }
}


Measured memory_bytes: 13268
k=int(input())
n=7
f=0
if k%2==0:
    f=0    
else:
    for i in range(1000000):
        if n%k==0:
            f=1
            break
        n=n*10+7
        n%=k
if f:
    print(i+1)
else:
    print(-1)
        
    

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

//iの各桁の和を計算し、a以上b以下であればtrueを返す関数
bool check(int i, int a, int b){
  int sum = 0;
  sum += i/10000 + i/1000%10 + i/100%10 + i/10%10 + i%10;
  if (a<=sum && sum<=b){
    return true;
  }else{
    return false;
  }
}

int main() {
  int n,a,b; cin >>n >>a >>b;
  int ans = 0;
  for (int i=1; i<n+1; i++){
    if (check(i,a,b)){
      ans += i;
    }
  }
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

	ll h, w;
	cin >> h >> w;
	map<char, ll> mp;
	vector<vector<char>> c(h, vector<char>(w));
	for (ll i = 0; i < h; i++) {
		for (ll j = 0; j < w; j++) {
			cin >> c[i][j];
			mp[c[i][j]]++;
		}
	}

	if (h % 2 == 0 && w % 2 == 0) {
		for (auto i = mp.begin(); i != mp.end(); i++) {
			if ((i -> second) % 4 > 0) {
				No();
				return 0;
			}
		}
		Yes();
	}
	else if (h % 2 == 0 || w % 2 == 0) {
		if (w % 2 == 1) swap(h, w);
		ll lim = w / 2;
		for (auto i = mp.begin(); i != mp.end(); i++) {
			if ((i -> second) % 4 == 0) continue;
			if ((i -> second) % 2 == 0) lim--;
			if ((i -> second) % 2 == 1 || lim < 0) {
				No();
				//cout << (i -> first) << " " << (i -> second) << endl;
				return 0;
			}
		}
		Yes();
	}
	else {
		ll lim1 = h / 2 + w / 2, lim2 = 1;
		for (auto i = mp.begin(); i != mp.end(); i++) {
			if ((i -> second) % 4 == 0) continue;
			if ((i -> second) % 2 == 0) lim1--;
			else lim2--;
			if (lim1 < 0 || lim2 < 0) {
				No();
				return 0;
			}
		}
		Yes();
	}
}


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

int main() {
  int n,a,b;cin>>n>>a>>b;
  cout<<min(a,b)<<" "<<max(0, a+b-n)<<endl;
  
}


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

int main()
{
    int n, d;

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> d;

        if( i >= 1 )
            cout << endl;

        if( d == 1 )
        {
            cout << "#" << endl;
            continue;
        }
        else if( d == 2 )
        {
            cout << "##" << endl;
            cout << "# " << endl;
            continue;
        }

        char a[d][d], cnt = 3;
        for( int j = 0; j < d; j++ )
            for( int k = 0; k < d; k++ )
                a[j][k] = ' ';

        for( int j = 0; j < d; j++ )
        {
            a[j][0] = '#';
            a[0][j] = '#';
            a[j][d-1] = '#';
        }

        int x = d - 1, y = d - 1;
        while( 1 )
        {
            if( cnt != d )
            {
                while( a[x][y-2] != '#' )
                {
                    a[x][y-1] = '#';
                    y--;
                }
                cnt++;
            }
            else
                break;

            if( cnt != d )
            {
                while( a[x-2][y] != '#' )
                {
                    a[x-1][y] = '#';
                    x--;
                }
                cnt++;
            }
            else
                break;

            if( cnt != d )
            {
                while( a[x][y+2] != '#' )
                {
                    a[x][y+1] = '#';
                    y++;
                }
                cnt++;
            }
            else
                break;

            if( cnt != d )
            {
                while( a[x+2][y] != '#' )
                {
                    a[x+1][y] = '#';
                    x++;
                }
                cnt++;
            }
            else
                break;            
        }
        for( int j = 0; j < d; j++ )
        {
            for( int k = 0; k < d; k++ )
                cout << a[j][k];
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3128
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val list: MutableList<Triple<String, Int, Int>> = java.util.ArrayList()
    for (i in 1..N) {
        val (S, Pstr) = readLine()!!.split(" ")
        val P = Pstr.toInt()
        list.add(Triple(S, P, i))
    }
    val list2 = list.sortedWith(java.util.Comparator { o1, o2 ->
        val res1 = o1.first.compareTo(o2.first)
        if (res1 != 0) {
            return@Comparator res1
        }
        return@Comparator -o1.second.compareTo(o2.second)
    })
    for (i in 0 until N) {
        if (i == N - 1) print(list2[i].third)
        else println(list2[i].third)
    }
}

Measured memory_bytes: 37952
import java.util.*;
public class Main{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int[] sea=new int[n+1];
    int[] bugs=new int[n+1];
    int[] hw=new int[n+1];
    for(int i=1;i<=n;i++)
    {
     sea[i]=sc.nextInt();
      bugs[i]=sc.nextInt();
      hw[i]=sc.nextInt();
    }
    int [][]happiness=new int[n+1][3];
    for(int i=1;i<=n;i++)
    {
      happiness[i][0]=sea[i]+Math.max(happiness[i-1][1],happiness[i-1][2]);
      happiness[i][1]=bugs[i]+Math.max(happiness[i-1][2],happiness[i-1][0]);
      happiness[i][2]=hw[i]+Math.max(happiness[i-1][1],happiness[i-1][0]);
    }
    int max=happiness[n][0];
    for(int i=1;i<3;i++)
    {
      if(happiness[n][i]>max)
         max=happiness[n][i];
    }
    System.out.println(max);
  }
}

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


int main(){
string str;
cin>>str;
for(int i=0;i<str.size();i++){
       // if(str[i]==',') cout<<i<<endl;

    if(i==5|| i==13 ) {str[i]=' ' ;}
}

cout<<str;


return 0;

}


Measured memory_bytes: 256
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define X real()
# define Y imag()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef complex < ld > point;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int n;
int a[N];

int main(){
  scanf("%d", &n);
  for(int i = 1; i <= n; ++i){
    scanf("%d", a + i);
  }
  int cnt = 1, res = 0;
  for(int i = 2; i <= n; ++i){
    if(a[i] != a[i - 1]){
      res += cnt / 2;
      cnt = 1;
    } else{
      ++cnt;
    }
  }
  res += cnt / 2;
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {

	static int N, M;
	static int[] a, b;
	static ArrayList<Integer>[] g;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();
		a = new int[M];
		b = new int[M];
		int[][] dp = new int[N][1 << N];
		dp[0][1] = 1;
		g = new ArrayList[N];
		for (int i = 0; i < N; ++i)
			g[i] = new ArrayList<Integer>();
		for (int i = 0; i < M; ++i) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			g[a[i]].add(b[i]);
			g[b[i]].add(a[i]);
		}

		for (int s = 0; s < 1 << N; ++s) {
			for (int cur = 0; cur < N; ++cur) {
				if (((1 << cur) & s) == 0 || dp[cur][s] == 0)
					continue;
				for (int dst : g[cur]) {
					if (((1 << dst) & s) > 0) {
						continue;
					} else {
						dp[dst][s | 1 << dst] += dp[cur][s];
					}
				}
			}
		}
		long ans = 0;
		for (int i = 0; i < N; ++i) {
			ans += dp[i][(1 << N) - 1];
		}
		System.out.println(ans);
	}
}

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

string solve(string &s,string &t)
{
    int m = s.length();
    int n = t.length();
    int dp[m+1][n+1];
    for(int i=0;i<=m;i++)
    dp[i][0]=0;
    for(int i=0;i<=n;i++)
    dp[0][i]=0;

    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(s[i-1]==t[j-1])
            {
                dp[i][j] = dp[i-1][j-1]+1;
            }
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int len = dp[m][n];
    string ans="";
    int i=m,j=n;
    while(len>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans = s[i-1]+ans;
            i--;
            j--;
            len--;
        }
        else
        {
            if(dp[i][j-1]>dp[i-1][j])
            {
                j--;
            }
            else
                i--;
        }
    }
    return ans;
}
int main()
{
    string s,t;
    cin>>s>>t;
    cout<<solve(s,t)<<endl;
}


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

using namespace std;

int main() {
	int x, y, a, b, c;
	scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
	vector<int> p(a);
	for(int &val : p) scanf("%d", &val);
	vector<int> q(b);
	for(int &val : q) scanf("%d", &val);
	vector<int> r(c);
	for(int &val : r) scanf("%d", &val);

	sort(p.rbegin(), p.rend());
	sort(q.rbegin(), q.rend());
	p.resize(x);
	q.resize(y);
	r.insert(r.end(), p.begin(), p.end());
	r.insert(r.end(), q.begin(), q.end());
	sort(r.rbegin(), r.rend());

	long long ans = 0;
	for(int i = 0; i < x + y; i++) {
		ans += r[i];
	}

	printf("%lld\n", ans);
}


Measured memory_bytes: 5964
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

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

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls1,pqls2;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<(x)<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,ans,a,b,c,d,e,f,g,h,i,j,k,w,ok,ng,l,q;
ll x[500005],y[500005],z[500005];
ll s[500005],t[500005];
tuple <ll,ll,ll> table[300005];
bool flag,dame;

int main(){
    cin >> a >> b >> c;
	num = 0;
	ans = -INF;
	for(i=0;i<a+b+c;i++){
		cin >> d >> e >> f;
		get<0>(table[i]) = e - d;
		get<1>(table[i]) = d - f; 
		get<2>(table[i]) = e - f; 
		num += f;
	}
	ll ans1=0,ans2=0;
	sort(table,table + a + b + c);
	for(i=0;i<a;i++){
		ans1 += get<1>(table[i]);
		pqls1.push(get<1>(table[i]));
	}
	for(i=0;i<a+b+c;i++){
		//最初からiまで
		if(i < a - 1){
			s[i] = -INF;
		}else if(i == a-1){
			s[i] = ans1;
		}else{
			pqls1.push(get<1>(table[i]));
			d = pqls1.top();
			e = get<1>(table[i]);
			pqls1.pop();
			ans1 += e - d;
			s[i] = ans1;
		}
	}
	for(i=a+b+c-1;i>a+c-1;i--){
		ans2 += get<2>(table[i]);
		pqls2.push(get<2>(table[i]));
	}
	for(i=a+b+c-1;i>=0;i--){
		if(a+b+c-i < b){
			t[i] = -INF;
		}else if(a+b+c-i == b){
			t[i] = ans2;
		}else{
			pqls2.push(get<2>(table[i]));
			d = pqls2.top();
			e = get<2>(table[i]);
			pqls2.pop();
			ans2 += e - d;
			t[i] = ans2;
		}
	}
	for(i=0;i<a+b+c;i++){
		//pe(s[i]);p(t[i]);
	}
	for(i=0;i<a+b+c-1;i++){
		ans = max(ans,s[i] + t[i+1]);
	}

	p(ans + num);
	return 0;
}

Measured memory_bytes: 34804
import sys
input = sys.stdin.readline

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    import itertools
    import bisect
    ac = [0] + list(itertools.accumulate(A))
    bc = [0] + list(itertools.accumulate(B))

    ans = 0
    for i, a in enumerate(ac):
        if a > K:
            break
        j = bisect.bisect_right(bc, K - a)
        ans = max(ans, i+j-1)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 50688
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    long long a1;
    long double p=3.14;
    long double a;
    cin>>a1;
    a=a1*1.0;
    cout<<2.0*p*a<<endl;
}

Measured memory_bytes: 3804
#include<stdio.h>
#include<math.h>

int main(){
    int N, W;
    int w[110], v[110];
    int i,j,k;
    long long int dp[110][110000];
    long long int dp1, dp2;

    for(i=0; i<110; i++){
        for(j=0; j<110000; j++){
            dp[i][j] == 0;
        }
    }

    scanf("%d %d", &N, &W);
    for(i=0; i<N; i++){
        scanf("%d %d", &w[i], &v[i]);
    }

    for(i=0; i<N; i++){
        for(j=0; j<=W; j++){
            if(j-w[i] >= 0){
                dp1 = dp[i][j-w[i]] + v[i];
                if(dp[i+1][j] < dp1){
                    dp[i+1][j] = dp1;
                }
            }
            if(dp[i+1][j] < dp[i][j]){
                dp[i+1][j] = dp[i][j];
            }
            //printf("%ld ", dp[i][j]);
        }
        //printf("\n");
    }
    printf("%ld", dp[N][W]);

    return 0;
}

Measured memory_bytes: 88192
//created by Whiplash99
import java.io.*;
import java.util.*;
public class Main
{
    private static long _gcd(long a, long b){return a==0?b:_gcd(b%a,a);}
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int i,N;

        N=Integer.parseInt(br.readLine().trim());
        String s[]=br.readLine().trim().split(" ");
        int a[]=new int[N];
        for(i=0;i<N;i++) a[i]=Integer.parseInt(s[i]);

        long ans=a[0];
        for(i=1;i<N;i++) ans=_gcd(ans,a[i]);
        System.out.println(ans);
    }
}

Measured memory_bytes: 46336
/* ****devACE**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        string s,t;
        int ct=0;
        cin>>s>>t;
        ct+=(s[0]==t[0]);
        ct+=(s[1]==t[1]);
        ct+=(s[2]==t[2]);
        cout<<ct<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

double x[30];
double y[30];
double z[30];

inline double dbl(double i){ return i * i; }

double dist(int i, int j){
  return sqrt( dbl(x[i] - x[j]) +
	       dbl(y[i] - y[j]) +
	       dbl(z[i] - z[j]) );
}

int main(){
  int cc;
  double qr, rp, pq;
  scanf("%d", &cc);

  while(cc --> 0){
    int n; 
    scanf("%lf%lf%lf", &qr, &rp, &pq);
    scanf("%d", &n);
    REP(i,n) scanf("%lf%lf%lf",x+i,y+i,z+i);
    vector<int> v(n);
    v[n-1] = v[n-2] = v[n-3] = 1;
    do{
      vector<int> pqr;
      REP(i,n) if(v[i]) pqr.push_back(i);

      do{
	const int p = pqr[0];
	const int q = pqr[1];
	const int r = pqr[2];
	const double e1 = dist(p, q) / pq;
	const double e2 = dist(q, r) / qr;
	const double e3 = dist(r, p) / rp;
	const double eps = 1e-5;

	if(std::abs(e1 - e2) < e1 * eps &&
	   std::abs(e2 - e3) < e2 * eps &&
	   std::abs(e3 - e1) < e3 * eps){
	  printf("%d %d %d\n", p + 1, q + 1, r + 1);
	  goto next;
	}
      }while(next_permutation(pqr.begin(), pqr.end()));
    }while(next_permutation(v.begin(), v.end()));
  next:;
  }

  return 0;
}

Measured memory_bytes: 0
#from collections import deque
#from heapq import heapify, heappop, heappush
#from bisect import insort
#from math import gcd
#mod = 10**9 + 7
#N = int(input())
N, X, M = map(int, input().split())
count = [(-1, 0) for _ in range(M)]
now = X
cnt = 0
ans = 0
roop = 0
roopsum = 0
while count[now][0] < 0 and cnt < N:
	cnt += 1
	ans += now
	count[now] = (cnt, ans)
	now = now*now%M
	#print(ans)
	if count[now][0] > 0 and cnt < N-1:
		start = count[now][0]
		end = cnt+1
		roop = end - start
		roopsum = ans+now - count[now][1]
#print(count)
#print(start, end)
#print(roop)

#print(roopsum)
if roop == 0:
	print(ans)
	exit()
ans += ((N-end+1)//roop)*roopsum
res = (N-end+1)%roop
for k in range(res):
	ans += now
	now = now*now%M
print(ans)

#A = list(map(int, input().split()))
#flag = True
#for k in range(N):
#ans = 0
#print(ans)
#print('Yes')
#print('No')

Measured memory_bytes: 74096
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1000000007;

int main() {
  int A, B;
  cin >> A >> B;
  if (A==B) cout << "Draw" << endl;
  else if (A==1) cout << "Alice" << endl;
  else if (B==1) cout << "Bob" << endl;
  else if (A<B) cout << "Bob" << endl;
  else cout << "Alice" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[105],n,k;
int dp[100005];
int rec(int rem){
	if(rem<0)return 0;
	if(dp[rem]!=-1)return dp[rem];
	for(int i=0;i<n;i++){
		int x=rec(rem-a[i]);
		if(x)return dp[rem]=0;
	}
	return dp[rem]=1;
}
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<=k;i++)dp[i]=-1;
	int b=rec(k);
	if(b)cout<<"Second";
	else cout<<"First";
}

Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<algorithm>
#include <string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>

#define ok printf("ok\n");
#define MAX 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define pb push_back

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

int main()
{
	ll n,sec,go;
	int ans = 0;
	string s,t;
	bool flag;
	cin >> s;
	cout << "2018";
	REP(i,4,s.size())
	{
		cout<<s[i];
	}
	
	return 0;
}

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

int main() {
    long a, b, m;
    cin >> a >> b >> m;
    
    int minrei = 100000;
    vector<int> reizoko(a);
    for (int i = 0; i < a; i++) {
        cin >> reizoko.at(i);
        minrei = min(minrei,reizoko.at(i));
    }
    
    int minden = 100000;
    vector<int> denshi(b);
    for (int i = 0; i < b; i++) {
        cin >> denshi.at(i);
        minden = min(minden,denshi.at(i));
    }
    
    long minsum = minrei + minden;
    
    for (int i = 0; i < m; i++) {
        long sum = 0;
        long x, y, c;
        cin >> x >> y >> c;
        
        sum = reizoko.at(x-1) + denshi.at(y-1) - c;
        minsum = min(minsum,sum);
    }
    
    
    cout << minsum << endl;
}


Measured memory_bytes: 1024
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let c: String = sc.input();

    println!("{}",
             if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
                 "vowel"
             } else {
                 "consonant"
             });
}


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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;

int mod=1000000007;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int main(){

int n,x,t;
cin>>n>>x>>t;
int ct=n/x;
if(n%x!=0){
    ct++;
}
int ans=ct*t;
cout<<ans<<endl;



}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll> 
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,ans=-1;cin>>a>>b;
  for(ll i=1;i<1010;++i) {
    if(floor(i*0.08)==a&&floor(i*0.10)==b) {
      ans=i;
      break;
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    long n, k, m, s;
    s = 0;
    cin>>n>>k;
    if(k == 0){
        cout<<n*n;
    }
    else{
    for(m=k+1;m<n+1;m++){
        s = s + (m-k)*((n-n%m)/m);
        if((n%m)>=k){
            s = s + (n%m)-k+1;
        }
    }
    cout<<s;
    }
}


Measured memory_bytes: 256