akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadInt;
            var B = cin.ReadInt;
            var T = cin.ReadInt;

            WriteLine(B * ( T / A ) );
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            if(4*i + 7*j == n) ans = 1;
        }
    }

    if(ans == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {

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

    int n = sc.nextInt();
    double a[] = new double[n];
    double sum = 0;
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
      sum += 1 / a[i];
    }
    System.out.println(1 / sum);
  }
}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;

int main() {
	int x, y;
	int z = 0;
	cin >> x >> y;
	while (!(x == 0 && y == 0)) {
		if (x >= y) {
			z = x;
			x = y;
			y = z;
			cout << x << " " << y << endl;
		}
		else {
			cout << x << " " << y << endl;
		}
		cin >> x >> y;
	}
}


Measured memory_bytes: 3032
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <bitset>
#include <iterator>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <random>
#include <numeric>
#include <set>
#include <cassert>
#include <cmath>
#include <cinttypes>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}
template<class T> T read_val() { throw 1; }
template<> int read_val() { int tmp; scanf("%" PRId32, &tmp); return tmp; }
template<> long long read_val() { long long tmp; scanf("%" PRId64, &tmp); return tmp; }
auto read_int = read_val<int>; auto read_long = read_val<long long>;
template<class T> void scanf_vec(vector<T>& vec) { for (int i = 0; i < vec.size(); i++) vec[i] = read_val<T>(); }

#define MOD 1000000007
#define inf 2000000000
#define FWT_SIZE 2000000
#define pii pair<int,int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define sort_all(x) sort(all(x))
#define make_unique(x) (x).erase(unique(all(x)), (x).end())


int main() {

#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n = read_int();
	long long m = read_int(), v = read_int();
	int p = read_int();
	vector<int> arr(n);
	scanf_vec(arr);

	sort(all(arr));
	vector<long long> prefs(n);
	prefs[0] = arr[0];
	for (int i = 1; i < n; i++) prefs[i] = prefs[i - 1] + arr[i];

	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		auto it = upper_bound(all(arr), arr[i] + m);
		int right_b = n;
		if (it != arr.end()) right_b = it - arr.begin();

		right_b = min(right_b, n - (p - 1));
		right_b = max(right_b, i + 1);
		long long bigger = n - right_b;
		if (bigger >= p)
			continue;

		long long total = v * m - m;
		long long potential = (long long)(n - right_b) * m;
		potential += (long long)i * m;

		long long len = right_b - i - 1;
		if (len > 0)
		{
			potential += m * len - (prefs[right_b - 1] - prefs[i] - (long long)arr[i]*len);
		}

		if (total <= potential)
			ans++;
	}

	printf("%d", ans);

	return 0;
}

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

using namespace std;

int main() {
  int K, S;
  cin >> K >> S;
  int ans = 0;
  for (int i = 0; i <= K; ++i) {
    for (int j = 0; j <= K; ++j) {
      int z = S - i - j;
      if (z >= 0 && z <= K) ans++;
    }
  }
  cout << ans << endl;
}

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n, m;
  cin >> n >> m;

  vector<P> a(m);
  rep(i, m) {
    cin >> a[i].first >> a[i].second;
  }

  ll s = pow(10, n - 1);
  ll e = s * 10;

  if (s == 1)
    s = 0;

  FOR(i, s, e) {
    bool ok = true;
    for (auto [s, c] : a) {
      ll v = (i / (int)pow(10, n - s)) % 10;
      if (v != c) {
        ok = false;
      }
    }
    if (ok) {
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int x,y,i;
	for(i=1;i<=3000;){
	cin>>x>>y;
	if(x==0&&y==0)
		break;
	if(x>y){
	swap(x,y);
	cout<<x<<" "<<y<<endl;
	}else{
	cout<<x<<" "<<y<<endl;
	}
	}
	return 0;
}

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

int main() {
  long long N, D;
  cin >> N >> D;
  
  vector<long long> X(N), Y(N);
  for (int i = 0; i < N; i++) {
    cin >> X.at(i) >> Y.at(i);
  }
  
  int count = 0;
  
  for (int i = 0; i < N; i++) {
    if (X.at(i) * X.at(i) + Y.at(i) * Y.at(i) <= D * D) {
      count++;
    }
  }

  cout << count << endl;

}


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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

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

int main() {
	int h, w;
	cin >> h >> w;
	char s[50][50];
	int dist[50][50] = {};
	int cnt = 0;
	for (int j = 0; j < h; j++)
		for (int i = 0; i < w; i++) {
			cin >> s[i][j];
			if (s[i][j] == '.')
				cnt++;
			dist[i][j] = 100;
		}
	queue<PI> q;
	q.push({ 0, 0 });
	dist[0][0] = 1;
	while (!q.empty()) {
		PI t = q.front(); q.pop();
		for (int i = 0; i < 4; i++) {
			int ny = t.first + dy[i];
			int nx = t.second + dx[i];
			if (ny < w && ny >= 0 && nx < h && nx >= 0) {
				if (s[ny][nx] == '.')
					if (dist[t.first][t.second] + 1 < dist[ny][nx]) {
						dist[ny][nx] = dist[t.first][t.second] + 1;
						q.push({ ny, nx });
					}
			}
		}
	}
	if (dist[w - 1][h - 1] == 100)
		cout << -1 << endl;
	else
		cout << cnt - dist[w - 1][h - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int N,M;
VI A(2500),B(2500);
VVI C(50,VI(50));
VI X(50);

void dfs(int A,int B,int S){
  X[S]=1;
  rep(i,50) if(C[S][i] and !X[i] and PII(A,B)!=PII(S,i) and PII(B,A)!=PII(S,i)){
    dfs(A,B,i);
  }
}

int main(){
  cin>>N>>M;
  VI A(M),B(M);
  rep(i,M) cin>>A[i]>>B[i];
  rep(i,M){
    C[A[i]-1][B[i]-1]=1;
    C[B[i]-1][A[i]-1]=1;
  }
  int ans=0;
  rep(i,M){
    rep(j,50) X[j]=0;
    dfs(A[i]-1,B[i]-1,0);
    int tmp=0;
    rep(j,50) tmp+=X[j];
    if(tmp!=N) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second

int arr[100010];
int pref[100010];
int suf[100010];

int main() {
	int n, x; scanf("%d", &n);
	for( int i = 0 ; i < n ; ++i ) scanf("%d", arr+i);
	pref[0] = arr[0];
	for( int i = 1 ; i < n ; ++i ) pref[i] = __gcd(pref[i-1], arr[i] );
	suf[n-1] = arr[n-1];
	for( int i = n-2 ; i >= 0 ; --i ) suf[i] = __gcd(suf[i+1], arr[i] );
	int mx = -1;
	for( int i = 0 ;  i < n ; ++i ){
		int nogcd = __gcd(pref[i-1], suf[i+1]);
		mx = max( mx, nogcd );
	}
	printf("%d\n", mx );
	return 0;
}


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

#define rep(i,n) for(ll i = 0; i < (n); i++)
#define REP(i,n) for(ll i = 1; i < (n); i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

#define int ll


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

  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  sort(rall(a));
  a.push_back(inf);
  int cnt = 0;
  int fir = 0, sec = 0;

  rep(i,n){
    cnt++;
    if(a[i] != a[i+1]){
      if(cnt >= 2 && fir == 0){
        fir = a[i];
        cnt -= 2;
      }
      if(cnt >= 2 && sec == 0){
        sec = a[i];
        break;
      }
      cnt = 0;
    }
  }
  ll ans = fir * sec;
  //cout << fir << " " << sec << endl;
  //cout << inf  << endl;
  cout << ans << endl;

}

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

#define N 100010

int main()
{
	int n,m,h[N+1],ma[N+1];
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>h[i];
	    ma[i]=0;
	}
	for(int i=1;i<=m;i++)
	{
		int a,b;
		cin>>a>>b;
		ma[a]=max(ma[a],h[b]);
	    ma[b]=max(ma[b],h[a]);
	}
	
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=h[i]>ma[i];
	}
	cout<<ans<<endl;
	return 0;
}
 

Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> inst(m);
  for(auto&& e: inst) 
  {
    cin>>e.first>>e.second;
    e.first--;
    e.second--;
  }
  set<int> box={0};
  map<int,int> map;
  for (int i = 0; i < n; ++i)
  {
    map[i]=1;
  }

  for(const auto& e: inst) 
  {
    map[e.first]--;
    map[e.second]++;
    if(box.find(e.first) != box.end())
    {
      box.insert(e.second);
    }
    if(map[e.first]==0)
    {
      box.erase(e.first);
    }
  }
  cout<<box.size()<<endl;
}

Measured memory_bytes: 10368
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args) throws Exception {
		FastScanner sc = new FastScanner();
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		System.out.println(a.charAt(0) + "" + b.charAt(1) + c.charAt(2));
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
 
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
 
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
 
		public int nextInt() {
			return Integer.parseInt(next());
		}
 
		public long nextLong() {
			return Long.parseLong(next());
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
 
	}
}

Measured memory_bytes: 22612
def run(n, k, num_array):
    '''
    '''
    print(sum([i for i in sorted(num_array)[:k]]))

if __name__ == '__main__':
    n, k = list(map(int, input().split()))
    num_array = list(map(int, input().split()))

    run(n, k, num_array)

Measured memory_bytes: 9244
n,k = map(int,input().split())
r = [int(i) for i in input().split()]
t = list(input())
def func(d,ans):
    if d==0:
        ans += r[2]
        dasite.append(2)
    elif d==1:
        ans += r[0]
        dasite.append(0)
    else:
        ans += r[1]
        dasite.append(1)
    return ans

for i in range(n):
    if t[i]=='r':
        t[i]=0
    elif t[i]=='s':
        t[i]=1
    else:
        t[i]=2
#グーを０にチョキを１にパーを2に書き換える
ans = 0
dasite = []
for i in range(n):
    if i<k:
        ans = func(t[i],ans)
    elif i>=n-k:
        if dasite[i-k]==(t[i]+2)%3:
            continue
        else:
            ans = func(t[i],ans)
    else:
        if dasite[i-k]==(t[i]+2)%3:
            if t[i]==t[i+k]:
                dasite.append(t[i])
            elif t[i]==(t[i+k]+1)%3:
                dasite.append(t[i+k])
            else:
                dasite.append((t[i]+1)%3)
        else:
            ans = func(t[i],ans)
print(ans)

Measured memory_bytes: 56848
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define LCIN(n) long long(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    LL from,to,cost;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        cost = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
bool check(int n){
    bool check = false;
    for(int a = 2;a < n;a++){
        int s = n;
        while(s % a==0){
            s /= a;
        }
        if(s==1){
            check = true;
            break;
        }
    }
    return check;
}
int main(){
    CIN(N);
    if(N==1){
        COUT(1);
        return 0;
    }
    for(int a = N;a >= 1;a--){
        if(check(a)){
            cout<<a<<endl;
            return 0;
        }
    }
    return 0;
}


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

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define REPR(i,a) for(int i = a; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

int gcd(int a, int b){ return b ? gcd(b, a % b) : a; }
template<typename A> void psn(A a){ cout << a << endl; }
template<typename A, typename... B> void psn(A a, B... b){ cout << a << ' '; psn(b...); }

int main(void) {

    int A, B;
    
    cin >> A >> B;
    
    if(A + B == 3) cout << '3' << endl;
    else if(A + B == 4) cout << '2' << endl;
    else cout << '1' << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 100001
#define maxa 2000005
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<pii, ll>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define mem(a, b) memset(a, b, sizeof(a))
#define sort(v) sort(v.begin(), v.end())
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout << setprecision(10) << fixed;
}
ll ceil(ll a, ll b){ return (a+ b-1)/b; }
void flaged(bool flag){
    if(flag) cout << "Yes\n";
    else cout << "No\n";
}
// power and modulo inverse
ll power(ll a, ll b = MOD-2){
    if(b == 0) return 1;
    ll r = power(a, b/2);
    r = (r*r)%MOD;
    if(b%2 == 1) r = (r*a)%MOD;
    return r;
}
// factorial
ll fact[maxa], finv[maxa];
void calf(){
    fact[0] = finv[0] = 1;
    for(ll i = 1; i < maxa; i++){fact[i] = (fact[i-1]*i) %MOD;finv[i] = (finv[i-1]*power(i))%MOD;}
}
// nCr
ll ncr(ll N, ll R){ if(R > N) return 0; return (fact[N]*((finv[R]*finv[N-R])%MOD))%MOD;}

vector<ll> vec[55];
ll dep[55], par[55], path[55];

void dfs(ll u, ll p){ //cout << u << " " << p << endl;
    dep[u] = dep[p]+1;
    par[u] = p;
    for(auto x: vec[u]){
        if(p!=x){
            dfs(x, u);
        }
    }
}

ll lca(ll x,ll y){
    ll maskx = 0; // masking the path from x to lca(x, y)
    ll masky = 0;
    if(dep[x] > dep[y]) swap(x, y);
    while(dep[y] > dep[x]){
        masky |= (1ll << y); y = par[y];
    }
    while(x != y){
        masky |= (1ll << y); y = par[y];
        maskx |= (1ll << x); x = par[x];
    }
    return maskx ^ masky;
}

void solve(){
    ll n;
    cin >> n;

    rep(i,n-1)
    {
        ll x, y; cin >> x >> y; edge(vec, x, y);
    }
    dfs(1, 0);
    ll m;
    cin >> m;
    rep(i, m)
    {
        ll x, y; cin >> x >> y;
        path[i] = lca(x, y); //cout << path[i] << " ";
    }
    ll mx = (1ll<< m), ans = 0;
    rep(i, mx)
    {
        ll num = 0, cnt = 0;
        rep(j, m)
        {
            if(i & (1ll<<j)){
                cnt++;
                num |= path[j];
            }
        }
        ans += (1ll << (n-1- __builtin_popcountll(num)))*(cnt%2 ?  -1ll: 1ll);
    }
    cout << ans;

}

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


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

using namespace std;


const int mod = 1e9 + 7;

int solve(int n, int m) {
	int ans = 1;
	int sum = n + m;
	for (int i = 1; i <= sum; ++i) {
		if (i % 2 == 0) {
			ans = 1LL * ans * n % mod;
			n--;
		}
		else ans = 1LL * ans * m % mod, m--;
	}
	return ans;
}

int main() {
int n, m;
	cin >> n >> m;
	if (abs(n - m) > 1) {
		cout << 0;
		return 0;
	}
	if (n == m) {
		cout << (2 * solve(n, m)) % mod;
	}
	else {
		if (n < m)swap(n, m);
		int ret = solve(m, n);
		cout << ret % mod;
	}
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊
    assert!(0 == 0); //😇
    let a = io.readn::<i64>(5);
    println!("{}", (15i64 - a.iter().fold(0i64, |sm, x| sm + x)));
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 2116
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = B[A[0]-1]
for i in range(1, n):
    ans += B[A[i]-1]
    if A[i-1]+1 == A[i]:
        ans += C[A[i]-2]


print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int N;
char s[64][128];
int t[64];
char X[128];

int main(void) {
	int i;
	int asumikana = 0;
	int yosinagasayuri = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%127s%d", s[i], &t[i]) != 2) return 1;
	}
	if (scanf("%127s", X) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (yosinagasayuri) asumikana += t[i];
		yosinagasayuri = yosinagasayuri || (strcmp(s[i], X) == 0);
	}
	printf("%d\n", asumikana);
	return 0;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
int main()
{
	 string s;
	 cin>>s;
	 for(int i=0;i<s.size();i++)
	 {
	 	if(i%2==0) cout<<s[i];
	 }
	 cout<<endl;
	 return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main(){
    int N; cin >> N;
    int ans;
    ans = N*N*N;
    cout << ans <<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long T = sc.nextLong();
		long ans = 0L;
		long nextT = 0L;
		for (int i = 0; i < N; i++) {
			long t = sc.nextLong();
			if (t < nextT) {
				ans += t + T - nextT;
			} else {
				ans += T;
			}
			nextT = t + T;
		}
		sc.close();

		System.out.println(ans);
	}
}


Measured memory_bytes: 62060
import java.io.*;
import java.util.*;
public class Main{
	static void main() throws Exception{
		int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
		char[][]in=new char[n][m];
		for(int i=0;i<n;i++)in[i]=sc.nextLine().toCharArray();
		int ans=0;
		for(int mskR=0;mskR<(1<<n);mskR++) {
			for(int mskC=0;mskC<(1<<m);mskC++) {
				int cnt=0;
				for(int i=0;i<n;i++) {
					for(int j=0;j<m;j++) {
						cnt+=(in[i][j]=='#' && ((mskR>>i)&1)==0 && ((mskC>>j)&1)==0)?1:0;
					}
				}
				ans+=cnt==k?1:0;
			}
		}
		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		sc=new MScanner(System.in);
		pw = new PrintWriter(System.out);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

Measured memory_bytes: 33160
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 10**9

for i in range(M):
    x, y, c = map(int, input().split())
    if ans > a[x-1] + b[y-1] - c:
        ans = a[x-1] + b[y-1] - c

if min(a) + min(b) < ans:
    ans = min(a) + min(b)

print(ans)


Measured memory_bytes: 97796
from itertools import permutations
from math import hypot

n = int(input())
cnt = 0
dis = 0

li = []
for i in range(n):
    x,y = map(int,input().split())
    li.append([x, y])

for a in permutations(li):
    cnt += 1
    for (x1,y1),(x2,y2) in zip(a,a[1:]):
        dis += hypot(x1-x2, y1-y2)

print(dis/cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> r(n),b(n);
    vector<bool> ok(n,false);
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        r[i]=make_pair(b,a);
    }
    for(int i=0;i<n;i++){
        int c,d;
        cin>>c>>d;
        b[i]=make_pair(c,d);
    }
    int ans=0;
    sort(b.begin(),b.end());
    sort(r.rbegin(),r.rend());
    for(int i=0;i<n;i++){
        int bx=b[i].first;
        int by=b[i].second;
        for(int j=0;j<n;j++){
            int rx=r[j].second;
            int ry=r[j].first;
            if(rx<bx&&ry<by&&!ok[j]){
                ans++;
                ok[j]=true;
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

const int MAX =
    2000000;  // 問題によって変更する(パスカルの三角形の段数、nCkのnの最大)
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
ll COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll superCOM(ll n, ll k) {
  ll res = finv[k] % MOD;
  for (ll i = 0; i < k; i++) {
    res *= (n - i) % MOD;
    res %= MOD;
  }

  return res % MOD;
}

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res % mod * a % mod;
    a = a % mod * a % mod;
    n >>= 1;
    res %= mod;
  }
  return res;
}

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

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

  COMinit();

  ll ans = (modpow(2, n, MOD) - 1);

  ll acom = superCOM(n, a) % MOD;
  ll bcom = superCOM(n, b) % MOD;

  cout << (((ans + MOD) - acom % MOD) + MOD - bcom % MOD) % MOD << endl;

  return 0;
}

Measured memory_bytes: 47104
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int nn=200005;
int n,x,a[nn]; ll sum[nn],ans=-1;
int main(){
    int i,j,k;ll tmp;scanf("%d%d",&n,&x);
    for(i=1;i<=n;i++){ scanf("%d",&a[i]); sum[i]=1ll*a[i]+sum[i-1]; }
    for(i=1;i<=n;i++){
        tmp=0;k=1;
        for(j=n;j>0&&tmp+1ll*i*x<ans;j-=i,k++){
            if(k==1) tmp+=5ll*(sum[j]-sum[max(0,j-i)]);
            else tmp+=(sum[j]-sum[max(0,j-i)])*(2ll*k+1ll);
        }
        if(ans==-1||tmp+1ll*i*x<ans) ans=tmp+1ll*i*x; 
    }
    cout<<ans+1ll*n*x<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    map<ll, ll> mp;
    FOR(i, 0, 3){
        ll a, b;
        cin >> a >> b;
        mp[a]++;
        mp[b]++;
    }

    for(auto p : mp){
        if(p.second >= 3){
            p_no();
            return 0;
        }
    }

    p_yes();
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin, (x).end()

int main(){
	int n,x; cin>>n>>x;
	int arr[n+1];
	arr[0]=0;
	int ans=0;
	for(int i=0; i<n; i++){
		int l; cin>>l;
		arr[i+1] = arr[i]+l;
	}
	for(auto& c: arr){
		if(c <= x)ans++;
	}
	cout<<ans<<endl;
}

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

int main() {
    int n, t; cin >> n >> t;
    vector<int> c(n);
    vector<int> tvec(n);
    int minc = 1e9;
    //int index;
    for (int i=0; i<n; i++) {
        cin >> c[i] >> tvec[i];
        if (tvec[i] <=  t) {
            minc = min(c[i], minc);
            //index = i;
        }
    }
    if (minc == 1e9) {
        cout << "TLE" << endl;
        return 0;
    }
    cout << minc << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,K,L; cin>>N>>K>>L;
  vii A(N),B(N);
  vi F(N,-1),G(N,-1);
  rep(i,0,K){
    int X,Y; cin>>X>>Y;
    A[X-1].pb(Y-1);
    A[Y-1].pb(X-1);
  }
  rep(i,0,N){
    if(F[i]==-1){
      queue<int> Q;
      Q.push(i);
      F[i]=i;
      while(Q.size()>0){
        int X=Q.front();
        Q.pop();
        rep(j,0,A[X].size()){
          int Y=A[X][j];
          if(F[Y]==-1){
            F[Y]=i;
            Q.push(Y);
          }
        }
      }
    }
  }
  rep(i,0,L){
    int X,Y; cin>>X>>Y;
    B[X-1].pb(Y-1);
    B[Y-1].pb(X-1);
  }
  rep(i,0,N){
    if(G[i]==-1){
      queue<int> Q;
      Q.push(i);
      G[i]=i;
      while(Q.size()>0){
        int X=Q.front();
        Q.pop();
        rep(j,0,B[X].size()){
          int Y=B[X][j];
          if(G[Y]==-1){
            G[Y]=i;
            Q.push(Y);
          }
        }
      }
    }
  }
  map<int,map<int,int>> E;
  rep(i,0,N){
    E[F[i]][G[i]]++;
  }
  rep(i,0,N){
    cout<<E[F[i]][G[i]]<<" ";
  }
  cout<<endl;
  }



Measured memory_bytes: 45696
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
    int n;
    float t,a;
    cin >> n >> t >> a;
    
    vector<float> h(n);
    int min=0;
    float tm;
    cin >> tm;
    h[0]= t- tm * 0.006;
    for(int i=1;i<n;i++){
        float tmp;
        cin >> tmp;
        h[i] = t - tmp * 0.006;
        if(fabs(a-h[min]) > fabs(a-h[i]))min=i; 
    }
    
        
    cout << min+1 << std::endl;
}


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

struct Problem {
public:

	void Solve() {
		UL N; cin >> N;
		ULL ans = 1;
		bool over = false;
		rep(i, N) {
			ULL A; cin >> A;
			if (A == 0) { over = false; ans = 0; break; }
			if (1000000000000000000 / A + 1 < ans) { over = true; }
			ans *= A;
		}
		if (over || ans > 1000000000000000000) cout << -1 << endl;
		else cout << ans << endl;
	}
};

int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
 int main(void){
int x,y,z;

scanf("%d%d%d", &x,&y,&z);

 int p = 0;
 if (x==y&& y!= z)p=1;
 if (y== z&& z!= x)p = 1;
 if (z==x&& x!= y)p = 1;

 if (p) {
 puts("Yes");
 } else {
 puts("No");
 }
 return 0;
}

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

#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  int cur,ans;
  char c;
  
  cur = ans = 0;
  while (cin >> c){
    if (c=='A'||c=='G'||c=='C'||c=='T'){
      cur++;
      ans = MAX(ans,cur);
    } else {
      cur = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
  

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto v = readln.chomp.split.to!(real[]);

  auto q = BinaryHeap!(real[], "a > b")(new real[1000], 0);

  foreach (e; v) {
    q.insert(e);
  }

  while (q.length != 1) {
    auto x = q.front;
    q.removeFront;
    auto y = q.front;
    q.removeFront;
    q.insert((x + y) / 2);
  }

  writefln("%.12f", q.front);
}


Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

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

  if (N >= 1000)
    cout << "ABD" << endl;
  else
    cout << "ABC" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(a+b>c+d)
    puts("Left");
  else if(a+b==c+d)
    puts("Balanced");
  else
    puts("Right");
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3

def gcd(m, n):
    if m < n:
        return gcd(n, m)
    if m % n == 0:
        return n
    return gcd(n, m % n)


def primeFactorize(n):
    primes = set()
    d = 2
    while d*d <= n:
        while n % d == 0:
            primes.add(d)
            n = n // d
        d += 1
    if n > 1:
        primes.add(n)
    return primes


def solve(A, B):
    primes = primeFactorize(gcd(A, B))
    return len(primes) + 1


if __name__ == '__main__':

    A, B = map(int, input().split())

    ans = solve(A, B)

    print(ans)


Measured memory_bytes: 3064
using System;
using System.Linq;

namespace ABC148D
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var an = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var cnt = 0;
            var pnt = 1;
            for (var i = 0; i < N; ++i)
            {
                if (an[i] == pnt)
                {
                    ++pnt;
                }
                else
                {
                    ++cnt;
                }
            }

            System.Console.WriteLine(pnt == 1 ? -1 : cnt);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 35676
n = int(input())
st = []
for i in range(n):
    s,t = input().split()
    st.append([s, t])
x = input()
f = 0
ans = 0
for s, t in st:

    if f:
        ans += int(t)
    if s == x:
        f = 1
print(ans)


Measured memory_bytes: 38620
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include<bits/stdc++.h>
#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++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  int n; cin >>n;
  vector<ll> vec(n);
  rep(i,n) cin >>vec[i];
  int ans=1;
  int key=vec[0];
  rep2(i,1,n) {
    if(vec[i]<=key) {
      ans++;
      key=vec[i];
    }
  }
    cout <<ans<<endl;
}
  
  
  
  

Measured memory_bytes: 1792
#include<iostream>
#include <bits/stdc++.h>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;


int main(){
    int A,B,C,D;
    cin >> A >> B>> C >> D;
    if((A+D-1)/D >= (C+B-1)/B){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[]) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringBuilder builder = new StringBuilder();
int i=1;
while(true){
int data= Integer.parseInt(reader.readLine());
if(data==0)
break;
builder.append("Case ").append(Integer.toString(i++)).append(": ").append(Integer.toString(data)).append("\n");
}
System.out.print(builder);
}
}

Measured memory_bytes: 31340
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n;
  int d[60], t[24] = {};
  
  scanf("%d",&n);

  for(int i=0;i<n;i++){
    scanf("%d",d+i);
    t[d[i]]++;
  }
  t[0]++;

  for(int i=1;i<12;i++){
    if(t[i] >= 2){
      t[24-i] ++;
      t[i]--;
    }
  }

  for(int i=0;i<24;i++){
    if(t[i] >= 2){
      puts("0");
      return 0;
    }
  }

  int ANS = 0;
  
  for(int i=0;i<(1<<11);i++){
    int memo[24];

    for(int j=0;j<24;j++)
      memo[j] = t[j];
    
    for(int j=1;j<12;j++){
      if((i & (1 << (j-1))) && memo[j] == 1 && memo[24-j] == 0){
        memo[j] = 0;
        memo[24-j] = 1;
      }
    }

    int ans = 25;

    for(int j=0;j<24;j++){
      for(int k=0;k<24;k++){
        if(memo[j] && memo[k] && j != k){
          ans = min({ans, abs(j-k), abs(24+j-k), abs(j-k-24)});
        }
      }
    }
    
    ANS = max(ANS, ans);
  }

  printf("%d\n",ANS);

  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1,-1, 0, 0};
int dy[4] = {0, 0, 1,-1};
signed main() {
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    int cnt = 0;
    while(B <= A) {
        B*=2;
        cnt++;
    }
    while(C <= B) {
        C*=2;
        cnt++;
    }
    if(cnt <= K) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3616
#include<iostream>
#include<cstdio>

int main(void){
	std::int64_t X,A,B;
	std::cin >> X;
	std::cin >> A;
	std::cin >> B;
	
	if(B <= A){
		std::cout << "delicious" << std::endl;
		return 0;
	}
	else if(B <= A+X){
		std::cout << "safe" << std::endl;
		return 0;
	}
	else{
		std::cout << "dangerous" << std::endl;
		return 0;
	}
}




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

bool Prime(int in){
	for (int i = 3; i <= sqrt(in); i += 2){
		if (in%i == 0)	return false;
	}
	return true;
}

vector<int> kakunou(vector<int> in){
	in.push_back(2);
	in.push_back(3);

	for (int i = 5;; i += 2){
		if (Prime(i))	in.push_back(i);
		if (in.size() >= 10000)	break;
	}

	return in;
}

int main(){
	int in, sum = 0;
	vector<int> vec;
	vec = kakunou(vec);
	while (cin >> in, in){
		sum = 0;
		vector<int>::iterator it = vec.begin();
		for (int i = 0; i < in; i++){
			sum += *it;
			++it;
		}
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1324
// Lec11-A Dice I
#include<iostream>
class Dice{
public:
  int d[7], tmp;
  Dice(int *in){
    for(int i=0; i<6; i++) d[i] = in[i];
  }
  void Rolling(std::string str){
    for(int i=0; i<str.length(); i++){
      switch(str[i]){
        case 'N':
        tmp=d[0],d[0]=d[1],d[1]=d[5],d[5]=d[4],d[4]=tmp;
        break;
        case 'S':
        tmp=d[0],d[0]=d[4],d[4]=d[5],d[5]=d[1],d[1]=tmp;
        break;
        case 'E':
        tmp=d[0],d[0]=d[3],d[3]=d[5],d[5]=d[2],d[2]=tmp;
        break;
        case 'W':
        tmp=d[0],d[0]=d[2],d[2]=d[5],d[5]=d[3],d[3]=tmp;
        break;
      }
    }
  }
  void print(){
    std::cout << d[0] << std::endl;
  }
};
int main(){
  int in[6];
  std::string str;
  for(int i=0; i<6; i++) std::cin >> in[i];
  std::cin >> str;
  Dice sample(in);
  sample.Rolling(str);
  sample.print();
  return 0;
}

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

const ll MX = 1e18;

int main(){
    int n;
    ll ans=1;
    cin >> n;
    bool ng = false;
    rep(i, n) {
        ll a;
        cin >> a;
        if (a == 0){
            cout << 0 << endl;
            return 0;
        }
        if(ng || MX/ans < a){
            ng = true;
        }
        ans *= a;
    }
    if(ng) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
long long R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]>N[H[b]]?1:0;
}
//挿入関数
void hin(long long a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
long long MAX(long long a,long long b){return a<b?b:a;}
int main(){
  long long i,j,n,a,d[2010][2010]={};
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld",&a);
    hin(a);
  }
  for(i=0;i<n;i++){
    a=hout();
    //printf("%lld %lld\n",a,N[a]);
    for(j=0;j<=i;j++){
      d[i+1][j  ]=MAX(d[i+1][j  ],d[i][j]+N[a]*labs((n-i+j)-a));
      d[i+1][j+1]=MAX(d[i+1][j+1],d[i][j]+N[a]*labs(a-(j+1)));
    }
  }
  /*for(i=0;i<=n;i++){
    for(j=0;j<=n;j++)printf("%3lld ",d[i][j]);printf("\n");
    }//*/
  for(i=j=0;i<=n;i++)j=MAX(j,d[n][i]);
  printf("%lld\n",j);
  return 0;
}


Measured memory_bytes: 33320