akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll>a;
	vector<ll>b;
	a.push_back(0);
	b.push_back(0);
	for(ll i=1;i<=n;i++){
		ll x;
		cin>>x;
		a.push_back(x);
	}
	for(ll j=1;j<=m;j++){
		ll x;
		cin>>x;
		b.push_back(x);
	}
	for(ll i=1;i<=n;i++){
		a[i]=a[i-1]+a[i];
	}
	for(ll i=1;i<=m;i++){
		b[i]=b[i-1]+b[i];
	}
	ll ans=0;
	for(ll i=0;i<=n;i++){
		ll ans2=i;
		ll sum=a[i];
		ll zan=k-a[i];
		if(zan==0){
			ans=max(ans,ans2);
			continue;
		}
		if(zan<0){
			continue;
		}
	//	cout <<zan<<endl;

	    auto itr=lower_bound(b.begin(),b.end(),zan);
	    if(*itr>zan||itr-b.begin()>m){
	    	itr--;
	    }
	    ans2+=itr-b.begin();
	 //   cout <<ans2<<endl;
	    ans=max(ans,ans2);
	//    	if(ans==4){
	//	cout << i<<endl;
	//}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 7972
#include<iostream>
using namespace std;
int main(){
  char c='a';
  int N;
  string S;
  cin>>N>>S;
  for(int i=0;i<S.size();i++){
    if(S[i]+N>90)printf("%c",S[i]+N-26 );
    else printf("%c",S[i]+N);
  }
  cout<<endl;
}


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

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
    long long N;
    cin >> N;
    auto pf = prime_factorize(N);
    long long res = 0;
    for (auto p : pf) {
        long long e = p.second;
        long long tmp = 0, cur = 1;
        while (e >= cur) e -= cur++, ++tmp;
        res += tmp;
    }
    cout << res << endl;
}


Measured memory_bytes: 3604
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

def main():
    N = I()
    P = LI()
    Min = N

    ans = 0
    for i in range(N):
        if Min >= P[i]:
            ans += 1
            Min = P[i]
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 70480
#include<iostream>
using namespace std;
int main(){
 int N, keta;
 cin >> N;
 switch(N%10){
    case 0:
    case 1:
    case 6:
    case 8:
        cout<<"pon";
        break;
    case 3:
        cout<<"bon";
        break;
    default:
        cout<<"hon";
        break;
 }
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N+1];
        for(int i=0; i<N; i++){
        	A[i] = sc.nextInt();
        }
        A[N] = 0;
        int current = 0;
        int next;
        int total = 0;
    	for(int j=0; j<A.length; j++){
			next = A[j];
			total += Math.abs(current-next);
			current = next;
    	}
    	
    	int diff;
        for(int i=0; i<N; i++){
        	if(i == 0)
        		diff = total - Math.abs(A[i]) - Math.abs(A[i]-A[i+1]) + Math.abs(A[i+1]);
        	else
        		diff = total - Math.abs(A[i]-A[i-1]) - Math.abs(A[i]-A[i+1]) + Math.abs(A[i-1]-A[i+1]);
        	System.out.println(diff);
        }
        
	}

}

Measured memory_bytes: 65616
def CraneAndTurtle():

    CraneAndTurtle = list(map(int,input().split()))

    Crane_num = (CraneAndTurtle[1] - 2.*CraneAndTurtle[0])/2.

    Turtle_num = (4.*CraneAndTurtle[0] - CraneAndTurtle[1])/2.

    flag_num_1 = float(float(CraneAndTurtle[1] - 2.*CraneAndTurtle[0])/2.) - int(float(CraneAndTurtle[1] - 2.*CraneAndTurtle[0])/2.)

    flag_num_2 = float(float(4.*CraneAndTurtle[0] - CraneAndTurtle[1])/2.) - int(float(4.*CraneAndTurtle[0] - CraneAndTurtle[1])/2.)

    if (flag_num_1 == 0 or flag_num_2 == 0) and ((0 <= Crane_num and  Crane_num <= CraneAndTurtle[0]) or (0 <= Turtle_num and  Turtle_num <= CraneAndTurtle[0])):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    CraneAndTurtle()

Measured memory_bytes: 9232
//c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    int time = 60 * H + M;
    double rad_A = 2*M_PI * time / (12*60);
    double rad_B = 2*M_PI * time / 60;
    double r = A*A + B*B - 2*A*B*cos(rad_A-rad_B);
    r = sqrt(r);
    cout << fixed << setprecision(20);
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <utility>
#define INF 1e16

using namespace std;
vector<vector<pair<int,long long> > >v(100010);
long long dist[100010];

void dfs(int s){
  for(int i=0;i<v[s].size();i++){
    if(dist[v[s][i].first]!=INF)continue;
    else{
      dist[v[s][i].first]=dist[s]+v[s][i].second;
      dfs(v[s][i].first);
    }
  }
  return;
}

int main(){
  int n;
  cin >> n;
  int i;
  fill(dist,dist+100010,INF);
  for(i=0;i<n-1;i++){
    int a,b,c;
    cin >> a >> b >> c;
    v[a].push_back(make_pair(b,c));
    v[b].push_back(make_pair(a,c));
  }
  int q,k;
  cin >> q >> k;
  dist[k]=0;
  dfs(k);
  int x ,y;
  for(i=0;i<q;i++){
    cin >> x >> y;
    cout << dist[x]+dist[y] << endl;
  }
  return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int l, k;
    cin >> l >> k;
    vector<vector<ll>> dp(l+1, vector<ll>(2));
    dp[0][1] = 1;
    for (int i = 1; i <= l; ++i) {
        dp[i][0] += dp[i-1][1];
        dp[i][1] += dp[i-1][0];
        if(i >= k){
            dp[i][0] += dp[i-k][1];
        }
    }
    ll ans = 0;
    for (int i = 1; i <= l; ++i) {
        ans += dp[i][0];
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;

int main(void)
{
    int    ans = 0;
    string s, t;
    cin >> s >> t;

    for (int i = 0, n = s.size(); i < n; ++i)
    {
        ans += (s[i] != t[i]);
    }

    cout << ans << endl;

    return 0;
}


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

int digits(int n) {
    int ans = 0;
    while(n) {
        ans++;
        n /= 10;
    }
    return ans;
}

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

    int n;
    cin>>n;
    int ans = 0;
    for(int i = 1;i <= n;i++) {
        if(digits(i) % 2 != 0) ans++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
program ABC169_B
  integer(16)::N,ans=1
  integer(16),allocatable::A(:)
  read(*,*)N
  allocate(A(N))
  read(*,*)A
  do i=1,N
     if(A(i)==0) then
        write(*,*)'0'
        stop
     end if
  end do
  do i=1,N
     ans=ans*A(i)
     if(ans>10_16**18_16) then
        write(*,*)'-1'
        stop
     end if
  end do
  write(*,*)ans
end program ABC169_B

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

//LIFE IS NOT A PROBLEM TO BE SOLVED

#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb push_back

using namespace std;

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

int N, tt;
int qt[5];
double pd[303][303][303];
bool calc[303][303][303];

double solve(int a, int b, int c){
	if(a==0 && b==0 && c==0) return 0.0;
	if(calc[a][b][c]) return pd[a][b][c]; calc[a][b][c] = true;
	double ret = 0.0;
	double pa = (double)(a)/(a+b+c);
	double pb = (double)(b)/(a+b+c);
	double pc = (double)(c)/(a+b+c);
	double cc = (double)(N)/(a+b+c);
	//cout << a << " " << b << ' ' << c << " " << pa << " " << pb << " " << pc << " " << cc << '\n';
	if(a) ret = ret + (solve(a-1, b, c)+cc)*pa;
	if(b) ret = ret + (solve(a+1, b-1, c)+cc)*pb;
	if(c) ret = ret + (solve(a, b+1, c-1)+cc)*pc;
	//cout << a << " " <<b << " " << c << " " << ret << "\n";
	return pd[a][b][c] = ret;
}

int main(){
	
	cin >> N; int aux;
	rep(i, 0, N){
		cin >> aux;
		tt+=aux;
		qt[aux]++;
	}
	
	printf("%.16lf\n", solve(qt[1], qt[2], qt[3]));
	
	
	return 0;
}

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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
//#define int ll
#define swap(x, y)((x)^=(y)^=(x)^=(y))
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define tcase int _; cin>> _; for( ; _; --_)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

void solve(){
    string s, t;
    cin >> s;
    cin>> t;
    
    int n = s.size();
    int m = t.size();

    int dp[n + 1][m+ 1], rec[n + 1][m + 1];
    memset(dp, -0x3f, sizeof(dp));
    dp[0][0] = 0;
    for(int i = 0; i<=n; ++i){
        for(int j = 0; j<=m; ++j){
            if(i + 1 <= n && dp[i + 1][j] < dp[i][j]){
                dp[i+1][j] = dp[i][j];
                rec[i+1][j] = 0;
            }
            if(j + 1 <= m && dp[i][j + 1] < dp[i][j]){
                dp[i][j+1] = dp[i][j];
                rec[i][j+1] = 1;
            }
            if(i + 1 <= n && j + 1 <= m && s[i] == t[j] && dp[i + 1][j + 1] < dp[i][j] + 1){
                dp[i+1][j+1] = dp[i][j] + 1;
                rec[i+1][j+1] = 2; 
            }
        }
    }
    int ns = n;
    int nt = m;
    int cu = dp[n][m] - 1;
    string ans = "";
    
    for(int i = 0; i<dp[n][m]; ++i) ans += '?';
    
    while(ns || nt){
        if(rec[ns][nt] == 0) ns--;
        else if(rec[ns][nt] == 1) nt--;
        else{
            ns--;
            nt--;
            ans[cu] = t[nt];
            cu--;
        }
    }
    cout<< ans << endl;
 }

int32_t main(){
	fastio;
	solve();
	return 0;
}



Measured memory_bytes: 73944
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1<<24)

struct state{
  int cost,pos,cnt;
  bool operator < (const state &p) const{
    return cost>p.cost;
  }
};

struct edge{
  int to,cost;
};

int c,n,m,s,d;
vector<edge> G[100];

void init(){
  for(int i=0;i<100;i++)G[i].clear();
}

int dijkstra(int si,int ti){
  int d[100][11];
  for(int i=0;i<100;i++)
    for(int j=0;j<11;j++)d[i][j]=INF;

  d[si][c]=0;
  priority_queue< state > Q;
  Q.push((state){0,si,c});

  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.cost>d[s.pos][s.cnt])continue;

    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      if(s.cost+e.cost>=d[e.to][s.cnt])continue;
      d[e.to][s.cnt]=s.cost+e.cost;
      Q.push((state){s.cost+e.cost,e.to,s.cnt});
    }

    if(s.cnt==0)continue;

    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      if(s.cost+e.cost/2>=d[e.to][s.cnt-1])continue;
      d[e.to][s.cnt-1]=s.cost+e.cost/2;
      Q.push((state){s.cost+e.cost/2,e.to,s.cnt-1});
    }
  }//while

  int res=INF;
  for(int i=0;i<=c;i++){
    res=min(res,d[ti][i]);
  }
  return res;
}

int main(){
  int a,b,f;
  while(cin>>c>>n>>m>>s>>d){
    if(n==0)break;
    init();
    for(int i=0;i<m;i++){
      cin>>a>>b>>f;
      a--;b--;
      G[a].push_back((edge){b,f});
      G[b].push_back((edge){a,f});
    }
    cout<<dijkstra(s-1,d-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1260
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}



int main()
{
    fastio();
    char s;
    cin>>s;
    if(s>='a' && s<='z') cout<<'a'<<endl;
    else cout<<'A'<<endl;
    return 0;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[][] matrix = new int[n][n];
        for(int i = 0; i < n; i++){
        	Arrays.fill(matrix[i], Integer.MAX_VALUE);
        }
        //Vertex[] v = new Vertex[n];
        for(int i = 0; i < n; i++){
        	String tmpStr = br.readLine();
        	
        	String[] tmp = tmpStr.split(" ");
        	for(int j = 0;j < Integer.parseInt(tmp[1]); j++){
        		matrix[i][Integer.parseInt(tmp[ 2*(j + 1)])] = Integer.parseInt(tmp[2*(j + 1) + 1]);
        	}

        }
        /*
        for(int i = 0; i < n; i++){
        	for(int j = 0; j < n; j++){
        		System.out.print(matrix[i][j]+ " ");
        	}
        	System.out.println();
        }
        */
        int[] dist = singleSourceShortestDense(matrix, 0);
        
        for(int i = 0; i < n ; i++){
        	System.out.println(i + " " + dist[i]);
        }
	}

	static int[] singleSourceShortestDense(int[][] matrix, int s){
		int n = matrix[0].length;
		int[] dist = new int[n];
		Arrays.fill(dist, Integer.MAX_VALUE);
		boolean[] visited = new boolean[n];
		Arrays.fill(visited, false);

		dist[s] = 0;
		
		while(true){
		
			int u = -1;
			int sd = Integer.MAX_VALUE;
			
			for(int i = 0; i < n ; i++){
				if(!visited[i] && dist[i] < sd){
					sd = dist[i];
					u = i;
				}
			}
			
			if(u == -1){
				break;
			}
			
			visited[u] = true;
			for(int v = 0; v < n ; v++){
				int w = matrix[u][v];
				if(v == u) continue;
				
				long newLen = dist[u];
				newLen += w;
				if(newLen < dist[v]){
					dist[v] = (int)newLen;
				}
			}

		}
		
		return dist;
	}

}

Measured memory_bytes: 554332
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


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

int main()
{
    string result_keys[] = {"AC"s, "WA"s, "TLE"s, "RE"s};
    int buckets[] = {0, 0, 0, 0};
    int N;
    io >> N;
    for (int i = 0; i < N; i++)
    {
        string s;
        io >> s;
        for (int j = 0; j < 4; ++j)
        {
            if (s == result_keys[j])
                ++buckets[j];
        }        
    }

    for (int j = 0; j < 4; ++j)
    {
        printf("%s x %d\n", result_keys[j].c_str(), buckets[j]);
    }
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n;
string s;

int main() {
	cin >> n >> s;
	
	int ans = 0;
	inc(i, n) {
		if(i == 0 || s[i] != s[i - 1]) { ans++; }
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
	char a;
  	cin >> a;
  	
  	if(isupper(a)) cout << "A" << endl;
  	else cout << "a" << endl;
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
import sys
import itertools

def solve(A: "List[int]"):

    minc = float("inf")
    for al in itertools.permutations(A):
        c = 0
        for i in range(1,len(al)):
            c += abs(al[i]-al[i-1])
        minc = min(minc,c)
    print(minc)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [ int(next(tokens)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
package main

import (
    "bufio"
    "fmt"
    "os"
)

var h, w, white, cnt int
var bs [][]byte
var qs, qs2 [][]int

func main() {
    fmt.Scan(&h, &w)
    bs = make([][]byte, h)
    qs = make([][]int, 0)
    white = h * w

    var sc = bufio.NewScanner(os.Stdin)
    for i := 0; i < h; i++ {
        sc.Scan()
        bs[i] = []byte(sc.Text())
        for j := range bs[i] {
            if bs[i][j] == '#' {
                qs = append(qs, []int{i, j})
                white--
            }
        }
    }

    for white > 0 {
        if cnt%2 == 0 {
            qs2 = make([][]int, 0)
            for k := range qs {
                loop(qs[k][0], qs[k][1])
            }
        } else {
            qs = make([][]int, 0)
            for k := range qs2 {
                loop(qs2[k][0], qs2[k][1])
            }
        }
        cnt++
    }

    fmt.Println(cnt)
}

func loop(i, j int) {
    // left
    if j > 0 && bs[i][j-1] == '.' {
        mark(i, j-1)
    }
    // top
    if i > 0 && bs[i-1][j] == '.' {
        mark(i-1, j)
    }
    // right
    if j < w-1 && bs[i][j+1] == '.' {
        mark(i, j+1)
    }
    // bottom
    if i < h-1 && bs[i+1][j] == '.' {
        mark(i+1, j)
    }
}

func mark(x, y int) {
    bs[x][y] = '#'
    if cnt%2 == 0 {
        qs2 = append(qs2, []int{x, y})
    } else {
        qs = append(qs, []int{x, y})
    }
    white--
}


Measured memory_bytes: 121088
#include<iostream>
using namespace std;
int main ()
{
    int a=0;
    int b=0;
    cin>>a>>b;
    int z=0;
    for (int i=1;i<100000;i++)
    {
     a=a-b;
     if(a<=0){
     cout<<i<<endl;
      break;}
    }
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll 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;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  int n;
  cin>>n;
  vi h(n+1);
  rep(i,n) cin>>h[i];
  vi dp(n+1,INF);
  dp[0]=0;
  for(int i=0;i<n-1;i++){
    mins(dp[i+2],dp[i+2]=dp[i]+abs(h[i+2]-h[i]));
    mins(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
  }
  cout<<dp[n-1]<<endl;
}    


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


int main()
{
	int n;
	double x, y, dist=0;
	cin>>n;
	double c[n][2];
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		c[i][0]=x;
		c[i][1]=y;
	}
	for(int i=0;i+1<n;i++)
	{
		for(int j=i+1;j<n;j++)
			{
				dist+=sqrt(pow(c[i][0]-c[j][0],2.0)+pow(c[i][1]-c[j][1],2.0));
			}
	}
	cout<<fixed<<setprecision(10)<<(2.0/n)*dist<<endl;
	
}

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

using namespace std;

int main(void){
  string S;
  cin >> S;
  int L=S.length(),p=0,check=0;
  while(p!=L){
    if(S.substr(p,6)=="eraser"){
      p+=6;
    }
    else if(S.substr(p,5)=="erase"){
      p+=5;
    }
    else if(S.substr(p,7)=="dreamer" && S.substr(p+5,5)!="erase"){
      p+=7;
    }
    else if(S.substr(p,5)=="dream"){
      p+=5;
    }
    else{
      check=1;
      break;
    }
  }
  if(check==0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using P = pair<ll,ll>;

const ll MX=1e18;

int main(){
    ll n;cin >>n;
    vector<ll>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
        if(a[i]==0){
            cout <<0<<endl;
            return 0;
        }
    }
    ll ans=1;
    for (int i = 0; i < n; ++i) {
        if((MX+1)/ans<a[i]||ans*a[i]>MX){
            cout <<-1<<endl;
            return 0;
        }
        if(ans*a[i]>MX){
            cout <<-1<<endl;
            return 0;
        }
        ans*=a[i];
    }
    cout <<ans <<endl;
    return 0;
}

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

int main(){
	int H, W, x, y, r;

	cin >> W >> H >> x >> y >> r;

	if (W - r>=x&&x>=r&&H - r>=y&&y>=r){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {x++;}
template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){if(n<k)return 0;if(n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

void solve(ll N, ll K, vector<ll> h){
    vll cost(N, LLONG_MAX);
    cost.at(0) = 0;

    rep2(i, 1, N - 1) {
        ll tmp = LLONG_MAX;
        rep2(j, 1, K) {
            if (i - j < 0) break;
            chmin(tmp, cost.at(i - j) + abs(h.at(i) - h.at(i - j)));
        }
        cost.at(i) = tmp;
    }
    printf("%lld\n", cost.at(N - 1));
}

int main() {
    ll N;
    ignore_ret(scanf("%lld",&N));
    ll K;
    ignore_ret(scanf("%lld",&K));
    vector<ll> h(N);
    for(int i = 0 ; i < N ; i++){
        ignore_ret(scanf("%lld",&h[i]));
    }
    solve(N, K, move(h));
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const ll md = 998244353;

const int mx = 50000;

ll mpow(ll a, ll e){
	ll res = 1;
	do {
		if(e&1) res = res * a % md;
		a = a * a % md;
	} while(e /= 2);
	return res;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	vector<ll> fs(mx,1);
	rep(i,1,mx) fs[i] = i*fs[i-1] % md;
	vector<ll> ifs(mx);
	rep(i,0,mx) ifs[i] = mpow(fs[i], md-2);

	auto bin = [&](int n, int k){
		return fs[n] * ifs[k] % md * ifs[n-k] % md;
	};

	string a,b;
	cin >> a >> b;
	int same = 0, dif = 0, n = sz(a);
	rep(i,0,n){
		if(a[i]=='1' && b[i]=='1') ++same;
	}
	dif = count(all(a), '1') - same;

	vector<vi> dp(same+1, vi(dif+1));
	dp[0][0] = 1;
	rep(i,1,same+1) dp[i][0] = 0;
	rep(d,1,dif+1) dp[0][d] = dp[0][d-1]*ll(d)*d%md;
	rep(i,1,same+1) rep(d,1,dif+1)
		dp[i][d] = d*(ll(d)*dp[i][d-1] + ll(i)*dp[i-1][d])%md;
	ll ans = 0;
	rep(i,0,same+1){
		ll cur = 1;
		cur *= bin(same, i);
		cur %= md;
		cur *= fs[same-i]*fs[same-i]%md;
		cur %= md;
		cur *= bin(dif + same, same-i);
		cur %= md;
		cur *= dp[i][dif];
		cur %= md;
		ans += cur;
	}
	ans %= md;
	if(ans < 0) ans += md;
	cout << ans << endl;
}

Measured memory_bytes: 50176
#include <iostream>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  map<int, int> m;
  int N; cin >> N;
  rep(i, N) {
    int a; cin >> a;
    ++m[a];
  }


  int M; cin >> M;
  rep(i, M) {
    int a; cin >> a;
    --m[a];
    if (m[a] < 0) {
      out("NO");
      return 0;
    }
  }
  out("YES");

  return 0;
}


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

int n,m,g[3000][3000],dp[3000],e[3000],vis[3000],x,y,f;

void dfs(int p,int t)
{
	if(vis[p])
	{
		if(vis[p]!=t+1)
			f=1;
		return;
	}
	vis[p]=t+1;
	if(t)
		x++;
	else
		y++;
	for(int i=1; i<=n; i++)
		if(i!=p&&!g[p][i])
			dfs(i,t^1);
}

int calc(int x)
{
	return x*(x-1)/2;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,a,b; i<=m; i++)
	{
		scanf("%d%d",&a,&b);
		g[a][b]=g[b][a]=1;
	}
	memset(dp,0,sizeof dp);
	dp[0]=1;
	for(int i=1; i<=n; i++)
	{
		if(vis[i])
			continue;
		x=0,y=0;
		dfs(i,0);
		memset(e,0,sizeof e);
		for(int j=n; j>=0; j--)
			e[j+x]|=dp[j],e[j+y]|=dp[j];
		for(int j=0; j<=n; j++)
			dp[j]=e[j];
	}
	if(f)
	{
		puts("-1");
		return 0;
	}
	int ans=n*n*2;
	for(int i=0; i<=n; i++)
		if(dp[i])
			ans=min(ans,calc(i)+calc(n-i));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 9600
import java.util.*;
public class Main {
	static String[] Day=new String[10];
	public static void setDay(){
		Day[0]="Wednesday";
		Day[1]="Thursday";
		Day[2]="Friday";
		Day[3]="Saturday";
		Day[4]="Sunday";
		Day[5]="Monday";
		Day[6]="Tuesday";
	}
	static int[] Month=new int[20];
	public static void setMonth(){
		Month[1]=31;
		Month[2]=29;
		Month[3]=31;
		Month[4]=30;
		Month[5]=31;
		Month[6]=30;
		Month[7]=31;
		Month[8]=31;
		Month[9]=30;
		Month[10]=31;
		Month[11]=30;
		Month[12]=31;
	}
	public static void main(String args[]){
		setDay();
		setMonth();
		Scanner in=new Scanner(System.in);
		int date,month,days;
		while(in.hasNextInt()){
			month=in.nextInt();
			date=in.nextInt();
			if(month==0&&date==0)
				break;
			days=0;
			for(int i=1;i<month;i++)
				days+=Month[i];
			days+=date;
			System.out.println(Day[days%7]);
		}
		in.close();
	}
}

Measured memory_bytes: 26228
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {

        void solve(InputReader in, PrintWriter out) {
            int H = in.nextInt();
            int N = in.nextInt();
            int sum = 0;
            for (int i = 0; i < N; ++i) {
                sum += in.nextInt();
            }
            out.println(sum >= H ? "Yes" : "No");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

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

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 33468
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;

int main() {
    int D, N; cin >> D >> N;
    int ans = 0;
    if(N==100) ans+=pow(100, D);
    ans+=pow(100,D)*N;
    cout << ans << endl;
    
    return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

vector<lint> divisor(lint n) {
	vector<lint> ret;
	for (lint i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.emplace_back(i);
			if (i * i != n) ret.emplace_back(n / i);
		}
	}
	sort(ret.begin(), ret.end(), greater<lint>());
	return ret;
}

lint gcd(lint a, lint b) { return b ? gcd(b, a%b) : a; }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<lint> A(N), div1, div2;
	for (int i = 0; i < N; i++) cin >> A[i];
	div1 = divisor(A[0]);
	div2 = divisor(A[1]);

	lint ans = 0, cnt;
	
	for (const auto &elem : div1) {
		cnt = 0;
		bool flag = false;
		for (int i = 0; i < N; i++) {

			if (A[i] % elem != 0) cnt++;
			if (cnt > 1) break;
			if (i == N - 1) {
				ans = elem;
				flag = true;
			}
		}if (flag) break;
	}

	for (const auto &elem : div2) {
		cnt = 0;
		bool flag = false;
		for (int i = 0; i < N; i++) {

			if (A[i] % elem != 0) cnt++;
			if (cnt > 1) break;
			if (i == N - 1) {
				ans = elem > ans ? elem : ans;
				flag = true;
			}
		}if (flag) break;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 1024
n,k = gets.chomp.split.map(&:to_i)
ary = gets.chomp.split.map(&:to_i)


ans = Float::INFINITY
(n-k+1).times do |num|
  i = num
  j = num+k-1
  ans1 = ary[i].abs+(ary[j]-ary[i]).abs
  ans2 = ary[j].abs+(ary[j]-ary[i]).abs
  ans = [ans,ans1,ans2].min
end
puts ans


Measured memory_bytes: 12036
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(a,b):
  return a*b//gcd(a,b)

INF=10**9+7

N=int(input())
A=[int(i) for i in input().split()]

temp=A[0]
for i in range(1,N):
    temp=lcm(temp,A[i])

ans=0
for a in A:
    ans+=(temp//a)

print(ans%INF)


Measured memory_bytes: 4084
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, W;
	cin >> n >> W;
	vector<int> w(n), v(n);
	int mi = 1e9;
	rep(i,n){
		cin >> w[i] >> v[i];
		chmin(mi, w[i]);
	}
	vector<int> zero, one, two, three;
	rep(i,n){
		if(w[i] - mi == 0) zero.push_back(v[i]);
		else if(w[i] - mi == 1) one.push_back(v[i]);
		else if(w[i] - mi == 2) two.push_back(v[i]);
		else three.push_back(v[i]);
	}
	sort(zero.rbegin(), zero.rend());
	sort(one.rbegin(), one.rend());
	sort(two.rbegin(), two.rend());
	sort(three.rbegin(), three.rend());
	ll ans = 0;
	for(int ze = 0; ze*mi <= W; ze++){
		if(ze > zero.size()) continue;
		for(int on = 0; ze*mi + on*(mi+1) <= W; on++){
			if(on > one.size()) continue;
			for(int tw = 0; ze*mi + on*(mi+1) + tw*(mi+2) <= W; tw++){
				if(tw > two.size()) continue;
				for(int th = 0; ze*mi + on*(mi+1) + tw*(mi+2) + th*(mi+3) <= W; th++){
					if(th > three.size()) continue;
					ll cmp = 0;
					rep(i,ze) cmp += zero[i];
					rep(i,on) cmp += one[i];
					rep(i,tw) cmp += two[i];
					rep(i,th) cmp += three[i];
					chmax(ans, cmp);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int d;
	cin >> d;
	if (d == 3 || d == 5 || d == 7)cout << "YES";
	else { cout << "NO"; }
	ed;
	return 0;
}


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

int main(){
  int temp,N,l,res=0;
  int id[100]={},C[100]={};
  cin >> N;
  for(int i=1;i<=2;i++){
    cin >> l;
    for(int j=0;j<l;j++){
      cin >> temp;
      id[temp-1]=i;
    }
  }
  cin >> l;
  for(int j=0;j<l;j++){
    cin >> temp;
    C[temp-1]=1;
  }

  for(int i=0;i<N;i++){
    res+=((id[i]!=1&&C[i]==1) || (id[i]==2&&C[i]==1))?1:0;
  }
  cout << res << endl;
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
constexpr int64_t LINF = LLONG_MAX/2;

int main() {
	int64_t N, M, K;
	cin >> N >> M >> K;
	vector<int64_t> v(N), w(M);
	vector<int64_t> vv(N), ww(M);
	rep(i, N) {
		cin >> v.at(i);
		if (i == 0) {
			vv.at(i) = v.at(i);
		} else {
			vv.at(i) = v.at(i) + vv.at(i-1);
		}
	}
	rep(i, M) {
		cin >> w.at(i);
		if (i == 0) {
			ww.at(i) = w.at(i);
		} else {
			ww.at(i) = w.at(i) + ww.at(i-1);
		}
	}
	if (v.at(0) > K && w.at(0) >K) {
		std::cout << "0" << '\n';
		return 0;
	}

	int64_t a=0, b=0, c=0, x, y, z;
	rep(i, N+1) {
		if (i == 0) x = 0;
		else x = vv.at(i-1);
		if (x > K) continue;
		y = 0;
		z = M;
		do {
			if (x + ww.at(0) > K) {
				y = -1;
				break;
			}
			// std::cout << ((y+z)/2) << " " << ww.at((y+z)/2)  << '\n';
			if (x + ww.at((y+z)/2) <= K) {
				y = (y+z)/2;
			} else {
				z = (y+z)/2;
			}
		} while (y+1 != z);
		chmax(a, i+y+1);
		// std::cout << a << " " << y << z << '\n';
	}

	std::cout << a << '\n';
}


Measured memory_bytes: 9596
using System;
using System.Collections.Generic;
using System.Linq;

class Program{

  static int n = 0;
  static double ans = 0;

  static int Main() {

    n = int.Parse(Console.ReadLine());
    double[] u = new double[n];

    for (int i = 0; i < n; i++) {
      string[] nyu = Console.ReadLine().Split(' ');
      if (nyu[1] == "JPY") {
        u[i] = double.Parse(nyu[0]);
      } else {
        u[i] = double.Parse(nyu[0]) * 380000;
      }
    }

    // ここまで入力

    ans = u.Sum();

    Console.WriteLine("{0}", ans);

    return 0;
  }

}


Measured memory_bytes: 13268
s=list(input())
n=len(s)
for ii in range(n//2):
  if s[ii]!=s[n-ii-1]:
    print("No")
    exit()
ss=s[0:n//2]
#print(ss)
nn=len(ss)
for ii in range(nn//2):
  if ss[ii]!=ss[nn-ii-1]:
    print("No")
    exit()
ss=s[(n+3)//2-1:n]
#print(ss)
nn=len(ss)
for ii in range(nn//2):
  if ss[ii]!=ss[nn-ii-1]:
    print("No")
    exit()
print("Yes")

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

int main() {
	string S,T;
	cin >> S >> T;
	int count = 0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i]) count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int A, B, total; cin >> A >> B;
    total = A + B;
    if (total < 10) cout << total << endl;
    else cout << "error" << endl;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int a,b; scanf("%d%d",&a,&b);
    int c=1,ans=0;
    while(c<b){
        c+=a-1; ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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




int main() {
    ll a, b;
    cin >> a >> b;
    
    for(ll t = b; t > 0; t /= 10){
        a *= 10;
    }
    
    ll c = a + b;
    if((ll)sqrt(c) * (ll)sqrt(c) == c){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

using ll = long long;
int main(){
   int k,n;
   cin >> n >> k;
   vector<double>p(n);
   for(int i=0;i<n;i++)cin >> p[i];
   double res = 0.0;
   vector<double> ruisekiwa(n+1, 0.0);
   for (ll i = 1; i <= n; ++i) {
    ruisekiwa[i] = ruisekiwa[i-1] + (p[i-1] + 1) / 2.0;//1 から P までの P 種類の目が等確率で出るサイコロの出目の期待値は (1 + P)/2 
  }//累積和はたくさん入ったものからいらないものを引くイメージ
 
  for (ll j = 0; j + k <= n; ++j) {
    double sbtr = ruisekiwa[j+k] - ruisekiwa[j];
    res = max(res, sbtr);
  }
 
  cout << setprecision(16) << res << endl;

}

Measured memory_bytes: 6488
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

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)*}};}
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)*}};}
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, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        a: usize,
        b: usize
    }

    if a == b {
        println!("0");
        return;
    }

    let big = if a > b { a } else { b };
    let small = if big == a { b } else { a };

    if (big - small) % 2 == 0 {
        println!("{}", (big - small) / 2);
    } else {
        let start_wall = small - 1;
        let end_wall = n - big;
        if end_wall > start_wall {
            // 1に近づく
            let big_move = big - 1;
            let small_move = small - 1 + 1;

            println!("{}", big_move - (big_move - small_move) / 2);
        } else {
            // nに近づく
            let small_move = n - small;
            let big_move = n - big + 1;
            println!("{}", small_move - (small_move - big_move) / 2);
        }
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 8572
mat = [[[0, 0]]*10 for _ in range(10)]
def dsr(i):
    x, cnt = 0, 0
    for j in range(10):
        w = x + i
        if w > 9:
            x = w - 9
            cnt += 2
        else:
            x = w
            cnt += 1
        mat[i][j] = [x, cnt-1]
    #mat[i][0][0] = mat[i][9][0]
    x0 = mat[i][9][1] - mat[i][8][1]   #; print('x0', x0)
    for j in range(10):
        mat[i][j][1] += x0 

for i in range(10):
    dsr(i)
#print2(mat)

m = int(input())
cnt = 0; x0 = 0   
for _ in range(m):
    d, c = map(int, input().split())
    q, r = divmod(c-1, 9)
    cnt += mat[d][8][1]*q + mat[d][r][1] - mat[d][0][1] 
    x = mat[d][r][0]
    #print('x, cnt', x, cnt)
    w = x0 + x
    if w > 9:
        x0 = w - 9
        cnt += 2
    else:
        x0 = w
        cnt += 1
    #print('x0, x, cnt', x0, x,  cnt)    
print(cnt-1) 

    

Measured memory_bytes: 9220
import math

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

theta = math.radians(360 * (H / 12 + M / (12 * 60) - M / 60))

print(
    math.sqrt(
        A * A + B * B - 2 * A * B * math.cos(min(math.radians(360) - theta, theta))
    )
)


Measured memory_bytes: 9484
#include <cstdio>
#include <algorithm>

using namespace std;

int main ()
{
   // freopen ("file.in", "r", stdin);

    int a, b, c;
    scanf ("%d %d %d", &a, &b, &c);

    if ((a & 1) && (b & 1) && (c & 1))
        printf ("%lld\n", min (1LL * a * b, min (1LL * a * c, 1LL * b * c)));

    else printf ("0\n");

    return 0;
}


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

def main():
    s = input()
    so = s[::2]
    se = s[1::2]
    if set(so) <= {"R", "U", "D"} and set(se) <= {"L", "U", "D"}:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef pair<ll, ll> PLL;

#define REP(i, j) for(int i=0;i<j;i++)
#define DREP(i, j) for(int i=j;i>=0;i--)
#define FOR(i, b, e) for(int i=b; i<=e; i++)
#define FORD(i, b, e) for(int i=b; i>=e; i--)
#define SIZE(x) ((int)x.size())
#define LAST(x) (x[SIZE(x)-1])
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sp ' '
#define ent '\n'

double dp[3005];
double p;
int n;

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

    cin >> n;

    dp[0]=1;

    REP(i, n){
        cin >> p;
        DREP(j, i+1){
            dp[j] = (j!=0 ? dp[j-1]*p : 0) + dp[j]*(1.0-p);
        }
    }
    double ans = 0.0;
    REP(i, n+1){
        int x = n-i;
        if(i!=0 && i>x)ans+=dp[i];
    }
    cout << setprecision(10) << fixed;
    cout << ans;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		for (int i=1; i<s.length(); i++){
			if (s.charAt(i-1) == s.charAt(i)){
				System.out.println("Bad");
				return;
			}
		}
		System.out.println("Good");

	}
}

Measured memory_bytes: 21844