akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//Random sc =new Random();
		int N=sc.nextInt();
		
		Map<String, Integer> map = new HashMap<String, Integer>(N);
		
		
		
		char a[]=new char[10];
		String t;
		for(int i=0;i<N;i++) {
			a=sc.next().toCharArray();
			Arrays.sort(a);
			t=String.valueOf(a);
		//	p(t);
			if(map.containsKey(t)) {
				map.replace(t, map.get(t)+1);
			}else {
				map.put(t, 1);
			}
		}
		
		long sum=0;
		for(String h:map.keySet()) {
			//p(h);
			long v=map.get(h.toString());
			if(v!=1) {
				if(v%2==0) {
					sum+=(v/2)*(v-1);
				}else {
					sum+=v*((v-1)/2);
				}
			}
		}
		p(sum);
	}
	
	
	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 54060
n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]

for i in range(n-1):
 ans=l[i][1]+l[i][0]
 for j in range(i+1,n-1):
  if ans<l[j][1]:
   ans=l[j][1]+l[j][0]
  else:
   if ans%l[j][2]!=0:
    ans+=l[j][2]-(ans%l[j][2])
   ans+=l[j][0]
 print(ans)

print(0)

Measured memory_bytes: 3188
//IncubatorMan
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
    ll n,m;
    read(n);
    read(m);
    vl data(m);
    for(int i=0;i<m;i++){
        read(data[i]);
    }
    ll total = accumulate(data.begin(),data.end(),0LL);
    if(total > n) cout<<"-1\n";
    else cout<<n-total<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        while(test--){
            solve();
        }
    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#define int long long
using namespace std;

int keta(int n){
	int ret = 0;
	while(n){
		ret++;
		n /= 10;
	}
	return ret;
}

int flor(int n){
	int ke = keta(n),tmp = 1;
	for(int i = 0;i < keta(n) - 1;i++) tmp *= 10;
	return tmp;
}

signed main(){
	int a,b,p;
	while(cin >> a >> b >> p,a){
		int dp[150000] = {};
		if(a >= 11112){
			if(keta(a) != keta(b)){
				int tmp = flor(b),x = 1,y = 1;
				for(int i = a;i < tmp;i++) x = x * 2 % p;
				for(int i = tmp;i <= b;i++) y = y * 2 % p;
				cout << (x + y + p - 2) % p << endl;
			}else{
				int x = 1;
				for(int i = a;i <= b;i++) x = x * 2 % p;
				cout << (x + p - 1) % p << endl;
			}
			continue;
		}
		for(int i = a;i <= b;i++){
			dp[i] = (dp[i - 1] * 2 - dp[flor(i) - 1] + p) % p;
			int tmp = i / 10;
			while(tmp){
				dp[i] = (dp[i] + dp[tmp] - dp[flor(tmp) - 1] + p) % p;
				tmp /= 10;
			}
			dp[i] = (dp[i] + 1) % p;
		}
		cout << dp[b] << endl;
	}
	return 0;
}

Measured memory_bytes: 4132
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main() {
	
	ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long int a=0,b=0,c=0,k=0,ans=0,r=0;
    cin>>a>>b>>c>>k;
    if(a>=k){
    	ans = k;
	} 
    else if(a+b>=k){
    	ans = a;
	}
    else{
    	ans = a;
    	r = k - a - b;
    	ans= ans - r;
	}
    cout<<ans;
    
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define mod 1000000007
#define cbrt cbrtl
using namespace __gnu_pbds;
using namespace std;

int main()
{
  IOS
  ll k;
  string s;
  cin>>s;
  cin>>k;
  ll l=s.length();
  ll i=0;
  ll j=l-1;
  char x=s[i];
  ll tot=0;
  while(i<=j && x==s[i])
  {
  	 i++;
  	 tot++;
  }
  while(j>i && x==s[j])
  {
  	 j--;
  	 tot++;
  }
  if(i>j)
  {
  	 ll len=l*k;
  	 cout<<len/2;
  	 return 0;
  }
  ll x1=i;
  ll y=(l-1-j);
  ll ans=0;
  for(;i<=j;i++)
  {
  	 char x=s[i];
  	 ll cnt=0;
  	 while(i<=j && x==s[i])
  	 {
  	 	 cnt++;
  	 	 i++;
  	 }
  	 i--;
  	 ans+=k*(cnt/2);
  }
  ans+=(k-1)*(tot/2);
  ans+=(x1/2);
  //cout<<y<<" ";
  ans+=(y/2);
  cout<<ans;
  return 0; 
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
      int N=sc.nextInt();
      long[] a=new long[N];
      long x=1;
      for(int i=0;i<N;i++){
      	a[i]=sc.nextLong();
       if(a[i]==0){
       	System.out.println(0);
         return;
       }
      }
      for(int i=0;i<N;i++){
      	if(a[i]<=1000000000000000000L/x){
       	x=x*a[i];
       }else{
       	System.out.println(-1);
         return;
       }
      }
      if(x<=1000000000000000000L){
      	System.out.println(x);
        return;
      }else{
      	System.out.println(-1);
        return;
      }
	}
}

Measured memory_bytes: 50112
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int INF=2*1e9;
int main()
{
    ll n,m,s,c,a[5]={0};
    bool x=0,y=0;
    set<ll> st[5];
    cin>>n>>m;
    rep(i,m)
    {
        cin>>s>>c;
        if(st[s].size()>0&&a[s]!=c) x=1;
        a[s]=c;
        st[s].insert(c);
    }
    rep1(i,n)
    {
        if(!y&&i!=n)
        {
            if(a[i]!=0) y=1;
            else
            {
                if(st[i].size()>0)
                {
                    x=1;
                    break;
                }
                else
                {
                    a[i]=1;
                    y=1;
                }
            }
        }
    }
    if(x) cout<<-1;
    else rep1(i,n) cout<<a[i];
}


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

using namespace std;

#define llong long long int
#define ternary(condition, x, y) ((condition) ? x : y) 
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main (int argc, char *argv[]) {
    cin.tie(0); 
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<bitset<10>> F(n);
    int f_sum = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 10; ++j) {
            int f;
            cin >> f;
            f_sum += f * (1 << 9 - j);
        }
        F[i] = f_sum;
        f_sum = 0;
    }

    vector<vector<int> > P(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 11; ++j) {
            int p;
            cin >> p;
            P[i].push_back(p);
        }
    }

    llong tmp_sum = 0;
    llong ans = -1000000000;
    for (int i = 1; i < (1 << 10); ++i) {
        bitset<10> mask(i);
        for (int j = 0; j < n; ++j) {
            int cnt = (F[j] & mask).count();
            tmp_sum += P[j][cnt];
        }
        ans = max(ans, tmp_sum);
        tmp_sum = 0;
        // cout << mask << endl;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)

using namespace std;

int main() {
    //freopen("a.inp", "r", stdin);
    int h, w, cnt = 0;
    char c;
    cin >> h >> w;
    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j) {
            cin >> c;
            if (c == '#') ++cnt;
        }
    cout << (cnt == h + w - 1 ? "Possible" : "Impossible");
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val m = readLine()!!.split(' ')[2].toInt()
    val a = readLine()!!.split(' ').map { it.toInt() }
    val b = readLine()!!.split(' ').map { it.toInt() }

    var min = a.min()!! + b.min()!!
    for (i in 0 until m) {
        val l = readLine()!!.split(' ').map { it.toInt() }
        min = Math.min(min, a[l[0]-1]+b[l[1]-1]-l[2])
    }

    println(min)
}


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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i=0; i<N; i++) cin >> S.at(i);
  sort(S.begin(), S.end());
  for (int i=0; i<N; i++)
    cout << S.at(i);
  cout << endl;
}

Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    S = input()
    T = input()
    count = 0
    for i in range(3):
        if S[i] == T[i]:
            count += 1
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>

#pragma 03
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2")

#define ll long long
#define ld long double
#define fi first
#define se second
#define sz(x) x.size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define min(a, b) (a < b) ? a : b
#define max(a, b) (a > b) ? a : b
#define int long long

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

inline void EXECUTE_TIME() {cout << endl << setprecision(10) << fixed << "CPU Time: " << clock() / double(CLOCKS_PER_SEC) << " sec(s)\n";}

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}
template <class T> inline T gcd(T a, T b) {if (b) return gcd(b, a % b); else return a;}
template <class T> inline T lcm(T a, T b) {return a / gcd(a,b) * b;}
template<typename T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;

const int N = 2019;

bitset<N*N> bs;

signed main() {
//    freopen("connect.in", "r", stdin);
//    freopen("connect.out", "w", stdout);
    fastio();

    int s = 0, a[N], n; cin >> n;
    rep(i, 0, n) cin >> a[i], s += a[i];
    bs = 1;
    for (int i = 0; i < n; i++) {
        bs |= (bs << a[i]);
    }

    for (int i = (s + 1) / 2; i <= s; i++) {
        if (bs[i]) {
            cout << i;
            return 0;
        }
    }

//    EXECUTE_TIME();
}



Measured memory_bytes: 5132
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

#define cell(g, i, j) (g)[((i) + 4) * (w + 8) + ((j) + 4)]

static int solve(const int h, const int w, const large k, const int x1, const int y1, const int x2, const int y2) {
    auto grid = vector<char>((w + 8) * (h + 8), '@');
    auto mincost = vector<large>((w + 8) * (h + 8) * 4, numeric_limits<large>::max());
    for (auto i = 0; i < h; ++i)
        for (auto j = 0; j < w; ++j)
            cin >> cell(grid, i, j);

    if (cell(grid, x1, y1) == '@') {
        return -1;
    }
    if (cell(grid, x2, y2) == '@') {
        return -1;
    }

    const auto pack = [w](int x, int y, int d) { return 4 * ((x + 4) * (w + 8) + (y + 4)) + d; };
    const auto unpack = [w](int packed) {
        auto d = packed % 4;
        packed /= 4;
        auto y = packed % (w + 8);
        auto x = packed / (w + 8);
        return make_tuple(x - 4, y - 4, d);
    };

    auto Q = priority_queue<pair<large, int>>();
    const pair<int, int> mov[4] = {
        {0, 1},
        {0, -1},
        {1, 0},
        {-1, 0},
    };
    const auto direction_str = array<string, 4>{"R", "L", "D", "U"};
    const auto checked_push = [&](int x, int y, int d, large new_cost) {
        auto key = pack(x, y, d);
        if (mincost[key] <= new_cost) {
            return;
        }
        mincost[key] = new_cost;
        Q.push(make_pair(-new_cost, key));
    };

    for (auto d = 0; d < 4; ++d) {
        checked_push(x1, y1, d, 0);
    }

    while (!Q.empty()) {
        const auto c = -(Q.top().first);
        const auto key = Q.top().second;
        Q.pop();

        if (mincost[key] != c)
            continue;
        const auto [x, y, d] = unpack(key);

        if (x == x2 && y == y2)
            return (c + k - 1) / k;

        for (auto d_next = 0; d_next < 4; ++d_next) {
            if (d_next != d) {
                checked_push(x, y, d_next, (c + k - 1) / k * k);
            }
        }

        const auto [dirx, diry] = mov[d];
        const auto nx = x + dirx;
        const auto ny = y + diry;
        if (cell(grid, nx, ny) == '.') {
            checked_push(nx, ny, d, c + 1);
        }
    }

    return -1;
}

int main() {
    int h, w, k;
    cin >> h >> w >> k;

    int x1, y1;
    int x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    x1--, y1--;
    x2--, y2--;
    cout << solve(h, w, k, x1, y1, x2, y2) << endl;
    return 0;
}


Measured memory_bytes: 293392
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int h, w; cin >> h >> w;
    vector<string> grid(h+2);
    rept(i, 1, h+1){
        string s; cin >> s;
        grid[i] = "*" + s + "*";
    }
    grid[0] = "";
    grid[h+1] = "";
    rep(i, w+10){
        grid[0] += "*";
        grid[h+1] += "*";
    }
    /*
    rep(i, h+2){
        rep(j, w+2){
            cout << grid[i][j];
        }cout << ln;
    }
    */
    const int dx[4] = {0,0,-1,1};
    const int dy[4] = {1,-1,0,0};
    vector<vector<int>> costs(h+2, vector<int>(w+2, INF));
    queue<pii> que;
    rept(i, 1, h+1){
        rept(j, 1, w+1){
            if(grid[i][j]=='#'){
                que.push({i, j});
                costs[i][j] = 0;
            }
        }
    }
    while(!que.empty()){
        auto p = que.front(); que.pop();
        int y = p.first, x = p.second;
        rep(k, 4){
            int nx = x + dx[k], ny = y + dy[k];
            if(grid[ny][nx] == '.'){
                grid[ny][nx] = '#';
                costs[ny][nx] = costs[y][x] + 1;
                que.push({ny, nx});
            }
        }
    }
    int res = -INF;
    rept(i, 1, h+1){
        rept(j, 1, w+1){
            chmax(res, costs[i][j]);
        }
    }
    cout << res << ln;
}
    


Measured memory_bytes: 17088
N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        print(0)
        exit()

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

ans_0 //= 2
ans = M//ans_0 - M//(ans_0*2)

print(ans)


Measured memory_bytes: 15060
N, W = map(int, input().split())

memo = [[-1] * (W + 1) for i in range(N + 1)]
w = 1
v = 0
l = []
for i in range(0, N):
    l.append(list(map(int, input().split())))

dp = [[0] * (W + 1) for i in range(N + 1)]
for i in range(N):
    for j in range(W + 1):
        if j < l[i][w]:
            dp[i + 1][j] = dp[i][j]
        else:
            if j - l[i][w] < 0:
                dp[i + 1][j] = dp[i][j]
            else:
                dp[i + 1][j] = max(
                    dp[i][j]
                    , dp[i][j - l[i][w]] + l[i][v])

print(dp[N][W])



Measured memory_bytes: 33440
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ans := 0.0
	for range make([]struct{}, n) {
		var x float64
		var u string
		fmt.Scan(&x, &u)
		switch u {
		case "JPY":
			ans += x
		case "BTC":
			ans += x * 380000
		}
	}
	fmt.Printf("%.5f\n", ans)
}


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


int main(){
 int r;
 cin >> r;
 double ans ;
 ans = 2*r*M_PI;
 printf("%.10f\n",ans);
   }

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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL H, W;
	LL h, w;
	cin >> H >> W >> h >> w;

	cout << ((H  - h) * (W - w)) << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Globalization;
using System.IO;
using System.Text;
using static Scanner;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        string S = Scan(), T = Scan();
        var temp = S;
        for (int i = 0; i < S.Length; i++) {
            temp = temp[^1] + temp[..^1];
            if (temp != T) continue;
            Console.WriteLine("Yes");
            return;
        }
        Console.WriteLine("No");
    }
}

public static class Scanner
{
    static readonly Stream stream = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte ConsoleIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stream.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = ConsoleIn();
        while ((by < '!' || '~' < by) && !isEof) by = ConsoleIn();
        return (char) by;
    }
    public static string Scan() {
        var sb = new StringBuilder();
        for (var ch = GetChar(); '!' <= ch && ch <= '~'; ch = (char) ConsoleIn()) {
            sb.Append(ch);
        }
        return sb.ToString();
    }
}

Measured memory_bytes: 23708
#include<bits/stdc++.h>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007





int lcm(int a,int b){
	return a/__gcd(a,b) * b;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
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;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


map< int, int > prime_factor(int n) {
  map< int, int > ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};



signed main()
{
  string s;
  ll K;
  cin>>s>>K;
  int N=s.size();
  int a[N];
  REP(i,0,N){
    a[i]=s[i]-'a';
    
  }
  string ans=s;
  REP(i,0,N){
    if(i==N-1){
      ans[i]=(a[i]+K)%26+'a';
    }else{
      if(a[i]==0){ continue;}
      else{
        int cost=26-a[i];
        if(K>=cost){
          K-=cost;
          ans[i]='a';
        }
      }
    }
  }
  cout<<ans<<endl;

}

Measured memory_bytes: 1024
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        ds: [i64],
    }
    let ans = ds.iter().collect::<std::collections::HashSet<_>>().len();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#define ll long long int

ll cost(ll x,ll y){return (x-y)*(x-y);}
ll min(ll x,ll y){return x<y?x:y;}
int main(void){
	ll n,a[100],i,ans=2000000,tmp;
	scanf("%lld",&n);
	for(i=0;i<n;i++)scanf("%lld",&a[i]);
	for(i=-100;i<=100;i++){
		tmp=0;
		for(int j=0;j<n;j++){
			tmp+=cost(i,a[j]);
		}
		ans = min(ans,tmp);
	}
	printf("%lld",ans);
	
	return 0;
}

Measured memory_bytes: 128
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*)a,b 
    if(mod(b,a)==0)then
        write(*,*)a+b
    else
        write(*,*)b-a 
    end if  
    stop
end program sample
  



Measured memory_bytes: 2860
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)

#define PI 3.1415926535897932385
#define INF 1e18
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007

void ayn(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

ll gcd(ll a, ll b)
{
    if (a == 0) return b;
    return gcd(b % a, a);
}
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }
ll mulmod(ll a, ll b, ll mod)
{
    ll res = 0;
    a = a % mod;
    while (b > 0)
    {
        if (b % 2 == 1) res = (res + a) % mod;
        a = (a * 2) % mod;
        b /= 2;
    }
    return res % mod;
}
int binCoeff(int n, int k)
{
    int C[n + 1][k + 1]; int i, j;
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }
    return C[n][k];
}

const int maxn = 100005;
int dfs(ll v, ll ans2, vector<bool>& visited, vector<vector<ll>>& vc){
    visited[v]=true;
    ans2++;
    for(auto z:vc[v])
    {
        if(!visited[z])
        {
           ans2+=dfs(z,0,visited,vc);
        }
    }
    return ans2;
}

ll conv(string n)
{
    string num = n;
    ll dec_value = 0;
    int base = 1;

    int len = num.length();
    for (int i=0; i<len; i++) {
        if (num[i] == '1') dec_value += base;
        base = base * 2;
    }
    return dec_value;
}

int main(){
    fastio;
    ayn();
    ll t; t=1;
    while(t--){
        ll a,b,n; cin>>a>>b>>n;
        ll mi=min(b-1,n);
        cout<<(a*mi)/b;
    }
    return 0;
}


Measured memory_bytes: 3648
n = int(input())
l = [i for i in range(1, n+1) if i%2 == 1]
ans = 0
cnt = 0
for i in l:
    for j in range(1, i+1):
        if i%j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
    cnt = 0
print(ans)


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

using namespace std;

int main() {
	int n;
	cin >> n;
	n%=10;
	if(n==3) {
		cout<<"bon"; 
	}
	else if(n==0 || n==1 || n==6 ||n==8) {
		cout<<"pon";
	}
	else {
		cout<<"hon";
	}
	return 0;
}

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

int main(void){
    int r,c;
    std::cin>>r>>c;
    std::vector<std::vector<int>> data(r,std::vector<int>(c,0));
    int i,j;
    for(i=0;i<r;i++){
        int sum=0;
        for(j=0;j<c;j++){
            std::cin>>data[i][j];
            sum+=data[i][j];
        }
        data[i].push_back(sum);
    }
    for(i=0;i<r;i++){
        for(j=0;j<c+1;j++){
            std::cout<<data[i][j];
            if(j!=c)std::cout<<" ";
        }
        std::cout<<std::endl;
    }
    for(i=0;i<c+1;i++){
        int sum=0;
        for(j=0;j<r;j++){
            sum+=data[j][i];
        }
        std::cout<<sum;
        if(i!=c)std::cout<<" ";
    }
    std::cout<<std::endl;
    return 0;
}

Measured memory_bytes: 3176
#include<iostream>
#include<cstring>
using namespace std;
int mas[110][110];
bool d[110][110];
int dy[6]={-1,-1, 0, 0, 1, 1};
int dx_k[6]={ 0, 1,-1, 1, 0, 1};
int dx_g[6]={-1, 0,-1, 1,-1, 0};
int wall=0;
int wall_len=0;
void dfs(int,int);
int main(){
  int x,y;

  memset(d,true,sizeof(d));
  memset(mas,0,sizeof(mas));

  cin >> x >> y;

  for(int i=1;i<y+1;i++){
    for(int j=1;j<x+1;j++){
      cin >> mas[i][j];
    }
  }
  /*
  for(int i=0;i<=y+1;i++){
    for(int j=0;j<=x+1;j++){
      cout << mas[i][j] << " ";
    }
    cout << endl;
    }*/

  dfs(0,0);
  cout << wall_len << endl;
}

void dfs(int y,int x){
  d[y][x]=false;

  for(int i=0;i<6;i++){
    int ny=y + dy[i];
    int nx;
    if(y&1) nx=x + dx_k[i];//yの１バイト目が１だったら（奇数だったら）
    else nx=x + dx_g[i];

    if(ny>=0 && ny< 110 && nx>=0 && nx< 110 && d[ny][nx]==true){//規定範囲外に出ない間。
      if(mas[ny][nx]==0){//壁がなかったら
	dfs(ny,nx);
      }
      else{//壁があったら
	wall_len++;
      }
    }

  }
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, X;
  cin >> N >> X;
  int ans = 0;
  int l;
  vector<int> D(N + 1, 0);
  REPI(i, 1, N + 1) {
    cin >> l;
    D.at(i) = D.at(i - 1) + l;
  }

  REP(i, N + 1) {
    if (D.at(i) <= X) {
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    p = il()
    print(len(set(p)))


if __name__ == '__main__':
    main()


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

int main(){
    int h,w;
    cin>>h>>w;
    char c[h][w];
    int cnt=0; // 白の数
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>c[i][j];
            if(c[i][j]=='.') cnt++;
        }
    }
    int dp[h][w]={};
    int INF=1e9;
    for(int i=0;i<h;i++)for(int j=0;j<w;j++){
        dp[i][j]=INF;
    }
    dp[0][0]=0;
    int cc=0;
    while(cc<30){
        for(int i=0;i<h;i++)for(int j=0;j<w;j++){
            if(j!=w-1 && c[i][j+1]=='.') dp[i][j+1]=min(dp[i][j+1],dp[i][j]+1);
            if(i!=h-1 && c[i+1][j]=='.') dp[i+1][j]=min(dp[i+1][j],dp[i][j]+1);
            //cerr<<dp[i+1][j+1]<<endl;
        }
        for(int i=h-1;i>=0;i--)for(int j=w-1;j>=0;j--){
            if(j!=0 && c[i][j-1]=='.') dp[i][j-1]=min(dp[i][j-1],dp[i][j]+1);
            if(i!=0 && c[i-1][j]=='.') dp[i-1][j]=min(dp[i-1][j],dp[i][j]+1);
            //cerr<<dp[i-1][j-1]<<endl;
        }
        cc++;
    }
    dp[h-1][w-1]=min(dp[h-1][w-2]+1,dp[h-2][w-1]+1);
    if(dp[h-1][w-1]>5000) {
        cout<<-1<<endl;
        return 0;
    }
    int ans=cnt-dp[h-1][w-1]-1;
    cout<<ans<<endl;

}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

const int INF = 1001001001;

int main()
{
    int N, M, S, T;
    cin >> N >> M;
    vector<vector<int>> d(N);
    vector<vector<int>> g(N, vector<int>(3, INF));

    rep(i, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        d[u].push_back(v);
    }
    cin >> S >> T;
    S--; T--;

    queue<pair<int, int>> q;

    g[S][0] = 0;
    q.push(make_pair(S, 0));
    while(!q.empty()) {
        int from = q.front().first;
        int l = q.front().second;
        int next_l = (l + 1) % 3;
        q.pop();
        IFD cout << "from: " << from << endl;
        for(int to : d[from]) {
            IFD cout << "to: " << to << " " << g[to][next_l];
            if(g[to][next_l] == INF) {
                IFD cout << " -> " << g[from][l] + 1;
                g[to][next_l] = g[from][l] + 1;
                q.push(make_pair(to, next_l));
            }
            IFD cout << endl;
        }
    }
    int ans = g[T][0];
    cout << (ans != INF ? ans / 3: -1) << endl;
    return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
	int n,ans=0;
	
	cin >> n;
	
	vector<int> v(n),s(n);
	
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	for(int i=0;i<n;i++){
		cin >> s[i];
	}
	
	for(int i=0;i<n;i++){
		if(v[i] > s[i]) ans += v[i]-s[i];
	}

	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int d,g;
    cin >> d >> g;
    vector<int> p(10,0);
    vector<int> c(10,0);
    for(int i = 0;i < d;i++){
        cin >> p[i] >> c[i];
    }
    int min = 100000;
    int score,num;
    int left;
    for(int bit = 0;bit < (1 << d);bit++){//{0,1,2...d-1}でp[i]は(i+1)*100点の問題
        score = 0;
        num = 0;
        //どの得点の問題を全て解くか
        for(int i = 0;i < d;i++){
            if(bit &(1 << i)){
                score += p[i]*100*(i+1)+c[i];
                num += p[i];
            }
        }
        if(score >= g){
            if(num < min)min = num;
        }else{//もし足りないとき
            left = g - score;
            for(int i = d-1;i > -1;i--){
                if(!(bit &(1<<i))){
                    if(((left + (i+1)*100 -1)/((i+1)*100))<=p[i]){
                        num += (left + (i+1)*100 -1)/((i+1)*100);
                        if(num < min)min = num;
                        break;
                    }else{
                        continue;
                    }
                }
            }
        }
    }
    cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a;i>0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7


int main() {
    string s;
    int y, m, d;
    char c1, c2;
    cin >> y >> c1 >> m >> c2 >> d;
    cout << (m <= 4 ? "Heisei" : "TBD") << endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    ll n, a, b;
    cin >> n >> a >> b;
    if (a == 0)cout << 0;
    else {
        ll d = n / (a + b);
        ll r = n % (a + b);
        cout << d * a + (r <= a ? r : a);
    }

    return 0;
}

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

int main(){
  int N;
  cin>>N;
  int a[N];
  for (int i=0;i<N;i++) cin>>a[i];
  sort(a,a+N);
  int temp=a[0];
  bool flag=0;
  AGAIN:
  for (int i=0;i<N;i++){
    if(a[i]==temp){
      continue;
    }
    a[i]=a[i]%temp;
    if((!(a[i]==0))&&(a[i]<temp)){
      flag=1;
      temp=a[i];
    }
  }
  if (flag==1){
    flag=0;
    goto AGAIN;
  }
  cout<<temp<<endl;
  return 0;
}
  
  

Measured memory_bytes: 640
#include<stdio.h>
#include<algorithm>


using namespace std ;



int ans ;



bool ok[ 1000 ][ 1000 ][ 1000 ] ;


int aa[ 3 ] ;


#define a aa[ 0 ]
#define b aa[ 1 ]
#define c aa[ 2 ]


int main()
{
	int n ;
	scanf( "%d" ,&n ) ;


	while( n-- )
	{
		scanf( "%d %d %d" ,&a ,&b ,&c ) ;


		--a ;
		--b ;
		--c ;


		sort( aa ,aa + 3 ) ;


		if( ok[ a ][ b ][ c ] )
		{
			++ans ;
		}
		
		else
		{
			ok[ a ][ b ][ c ] = true ;
		}
	}



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


	return 0 ;
}

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

using namespace std;
mt19937_64 rng(58);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int64_t d, t, s;
    cin >> d >> t >> s;
    cout << ((t * s >= d) ? "Yes" : "No") << '\n';
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll n; cin >> n;
  vector<int> ans;
  --n;
  do {
    ans.push_back(n%26);
    n/=26;
    --n;
  } while(n >= 0);

  reverse(ALL(ans));
  for(auto x : ans) cout << (char)(x+'a');
  cout << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define  pb push_back
#define  xx first
#define  yy second
#define ll long long
using namespace std;

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


      ll n,k,cnt= 0;
      cin >> n;
      while(n>0){
        cnt++;
        n/=2;
      }
      ll ans = 1;
     for(int i=1; i<=cnt; i++){
        ans = ans*2;
     }
      cout << ans-1<<endl;


   return 0;
}


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

void trans(char *x, char *y, int v)
{
    while (v++ < 81) *x = '0', x++;
    strcat(x, y);
}
 
int main(void)
{
    int n;
    char a[128], b[128];
    char x[128], y[128];
    char *output;

    scanf("%d", &n);
    while (n--){

        output = "overflow";
        scanf("%81s %81s", a, b);
        if (fmax(strlen(a), strlen(b)) < 81){
            int carry, i;
 
            memset(x, 0, 256);
 
            trans(x, a, strlen(a));
            trans(y, b, strlen(b));
             
            for (carry = i = 0; i < 81; i++){
                int v = x[80 - i] - '0' + y[80 - i] - '0' + carry;
                carry = v > 9;
                x[80 - i] = v % 10 + '0';
            }
            for (i = 0; i < 80 && x[i] == '0'; i++);
            if (i) output = x + i;
        }
        puts(output);
    }
    return (0);
}

Measured memory_bytes: 592
#include <stdio.h>

int main(){
    char input_S[4];

    scanf("%s", input_S);

    if(input_S[0] == '7'){
        printf("Yes");
    }else if(input_S[1] == '7'){
        printf("Yes");
    }else if(input_S[2] == '7'){
        printf("Yes");
    }else if(input_S[3] == '7'){
        printf("Yes");
    }else{
        printf("No");
    }

    return(0);
}

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


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        var k = sc.intarr;
        int n = k[0];

        int m = 0, a = 0, r = 0, c = 0, h = 0;
        int[] k1 = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 };
        int[] k2 = { 1, 1, 1, 2, 2, 3, 2, 2, 3, 3 };
        int[] k3 = { 2, 3, 4, 3, 4, 4, 3, 4, 4, 4 };

        for(int i = 0; i < n; ++i)
        {
            string s = sc.str;
            if (s[0] == 'M') m++;
            if (s[0] == 'A') a++;
            if (s[0] == 'R') r++;
            if (s[0] == 'C') c++;
            if (s[0] == 'H') h++;

        }
        long ans = 0;
        long[] d = { m, a, r, c, h };
        for(int i = 0; i < 10; ++i)
        {
            ans += d[k1[i]] * d[k2[i]] * d[k3[i]];
        }

        wr.wri(ans);


    }

}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => strarr.Select(char.Parse).ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 15316
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e18+7;
const ll MOD=1000000007;


class Topological_Sort{
private:
    ll v;
    vector<vector<ll>> E;
    vector<ll> count;
    
public:
    Topological_Sort(ll v):v(v){
        E.resize(v);
        count.resize(v,0);
    }
    
    void add_edge(ll from,ll to){
        E[from].push_back(to);
        count[to]++;
    }
    
    vector<ll> sort(){
        vector<ll> c=count;
        vector<ll> ret;
        for(int i=0;i<v;i++){
            if(c[i]==0){ret.push_back(i);}
        }
        for(int i=0;i<ret.size();i++){
            for(int t=0;t<E[ret[i]].size();t++){
                ll to=E[ret[i]][t];
                c[to]--;
                if(c[to]==0){ret.push_back(to);}
            }
        }
        return ret;
    }
};



int main(){
    ll v,e;
    cin>>v>>e;
    Topological_Sort T(v);
    for(int i=0;i<e;i++){
        ll s,t;
        cin>>s>>t;
        T.add_edge(s,t);
    }
    vector<ll> a=T.sort();
    assert(a.size()==v);
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 4180
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int main(){
    int n;
    cin >> n;
    int p[n];
    rep(i,n){
        cin >>p[i];
    }
    int temp=INF;
    int ans=0;
    rep(i,n){
        if(p[i]<temp){
            ans++;
            temp=p[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1024