akhauriyash/Code-Regression huggingface dataset:
#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 ll long long
int main(){
  int N;
  cin>>N;
  cout<<(N-2)*180<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  double ans;
  if (N % 2 == 1) {
    ans = ((double)N + 1)/(2*(double)N);
  }
  else {
    ans = 1.0/2.0;
  }
  printf("%.10lf\n", ans);
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
                
    return divisors

ls = make_divisors(a)
ls2 = make_divisors(b)
ls3 = (set(ls)&set(ls2))
ls3 = sorted(ls3,reverse=True)
print(ls3[k-1])



Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
typedef long long ll;
const ll mod=998244353;
const int N=405;
ll p[N],inv[N];
ll qpow(ll x,ll y) {
    ll res=1;
    for(;y;y>>=1,x=x*x%mod) if(y&1) res=res*x%mod;
    return res;
}
int n,a[N],b[N];
void init() {
    p[0]=1;
    for(int i=1;i<N;i++) p[i]=p[i-1]*i%mod;
    inv[N-1]=qpow(p[N-1],mod-2);
    for(int i=N-2;~i;i--) inv[i]=inv[i+1]*(i+1)%mod;
}
ll dp[N][N];
int main() {
    scanf("%d",&n);
    dp[0][0]=(mod-1);
    init();
    int sa=0,sb=0;
    for(int i=1;i<=n;i++) scanf("%d%d",a+i,b+i),sa+=a[i],sb+=b[i];
    for(int i=1;i<=n;i++) {
        for(int x=sa-1;~x;x--) for(int y=sb;~y;y--) {
            if(!dp[x][y]) continue;
            ll now=1;
            for(int j=1;j<b[i]&&y+j<=sb;j++) {
                now=now*a[i]%mod;
                dp[x+a[i]][y+j]=(dp[x+a[i]][y+j]-now*dp[x][y]%mod*inv[j]%mod+mod)%mod;
            }
            dp[x+a[i]][y]=(dp[x+a[i]][y]-dp[x][y]+mod)%mod;
        }
    }
    ll ans=0;
    for(int i=1;i<=sa;i++) for(int j=0;j<=sb;j++) {
        ll tmp=qpow(qpow(i,mod-2),j)*dp[i][j]%mod*p[j]%mod*(sa*qpow(i,mod-2)%mod);
        ans=(ans+tmp)%mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int,int > pp;
typedef long long ll;
 
#define sz(x) (int)x.size() 
int const N=5e5+10;

int aa[N];
int main() {
	int n;
	cin>>n;
	int mx1=0,mx2=0;
	for(int i=0;i<n;i++){
		cin>>aa[i];
		if(aa[i]>mx1){
			mx2=mx1;
			mx1=aa[i];
		}else if(aa[i]>mx2){
			mx2=aa[i];
		}
	}
	for(int i=0;i<n;i++){
		if(aa[i]<mx1)cout<<mx1<<'\n';
		else cout<<mx2<<'\n';
	}
    return 0;
}



Measured memory_bytes: 2432
import java.lang.String;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String s[] = new String[2];
        Scanner sc = new Scanner(System.in);
        s[0] = sc.next();
        s[1] = sc.next();
        if (s[0].charAt(0) != s[1].charAt(2))
            sayNo();
        else if (s[0].charAt(1) != s[1].charAt(1))
            sayNo();
        else if (s[0].charAt(2) != s[1].charAt(0))
            sayNo();
        else
            System.out.println("YES");

    }

    static void sayNo() {
        System.out.println("NO");
    }

}

Measured memory_bytes: 23636
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    vvint bl(h,vint(w,0));
    REP(i,h){
        string s;
        cin >> s;
        REP(j,w){
            if(s[j]=='#'){
                bl[i][j]=1;
            }else{
                bl[i][j]=0;
            }
        }
    }
    vector<vector<vector<int> > > l(h,vvint(w,vint(4,0)));
    REP(i,h){
        l[i][0][0] = 0;
        if(bl[i][0]==1) l[i][0][0] = -1;
        REP(j,w-1){
            if(bl[i][j+1]==0){
                l[i][j+1][0] = l[i][j][0]+1;
            }else{
                l[i][j+1][0] = -1;
            }
        }
    }
    REP(i,h){
        l[i][w-1][1] = 0;
        if(bl[i][w-1]==1) l[i][w-1][1] = -1;
        for(int j=w-2;j>=0;--j){
            if(bl[i][j]==0){
                l[i][j][1] = l[i][j+1][1]+1;
            }else{
                l[i][j][1] = -1;
            }
        }
    }
    
    REP(j,w){
        l[0][j][2]=0;
        if(bl[0][j]==1) l[0][j][2] = -1;
        REP(i,h-1){
            if(bl[i+1][j]==0){
                l[i+1][j][2] = l[i][j][2]+1;
            }else{
                l[i+1][j][2] = -1;
            }
        }
    }
    REP(j,w){
        l[h-1][j][3]=0;
        if(bl[h-1][j]==1) l[h-1][j][3] = -1;
        for(int i=h-2;i>=0;--i){
            if(bl[i][j]==0){
                l[i][j][3] = l[i+1][j][3]+1;
            }else{
                l[i][j][3] = -1;
            }
        }
    }
    int ans = 0;

    REP(i,h){
        REP(j,w){
            int t = 0;
            REP(k,4) t+=l[i][j][k];
            ans = max(ans,t);
        }
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 234880
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b, x := fScan(), fScan(), fScan()
	if x >= a*a*b/2. {
		fmt.Println(math.Atan((a*a*b-x)*2./a/a/a) / 2 / math.Pi * 360)
	} else {
		fmt.Println(math.Atan(a*b*b/2/x) / 2 / math.Pi * 360)
	}
}


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

int main(){
    int s;
    cin >> s;
    set<int> se;
    int ans;
    rp(i,1000002){
        se.insert(s);
        if(s&1) s=3*s+1;
        else s/=2;
        auto ite=se.find(s);
        if(ite==se.end()) continue;
        else{
            ans=i+2;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        vector<string> S(N);
        for (int i = 0; i < N; ++i) cin >> S[i];
        vector<vector<char>> vvc(2 * N, vector<char>(2 * N));
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                vvc[i][j] = vvc[i + N][j] = vvc[i][j + N] = vvc[i + N][j + N] = S[i][j];
            }
        }

        Int cnt = 0;
//        for (int i = N; i < 2 * N; ++i) {
//            int sh = 0;
//            int sw = i;
//            string s;
//            for (int j = 0; j < N; ++j) {
//                int h = sh + j;
//                int w = sw - j;
//                s += vvc[h][w];
//            }
//            string t = s;
//            reverse(all(s));
//            if (s == t) cnt++;
//        }
        for (int A = 0; A < N; ++A) {
            bool ok = true;
            for (int i = 0; i < N; ++i) {
                for (int j = 0; j < N; ++j) {
                    if (vvc[i + A][j] != vvc[j + A][i]) {
                        ok = false;
                    }
                }
            }
            if (ok)cnt++;
        }
        Int ans = cnt * N;
        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


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

using namespace std;
struct pos{
    int x;
    int y;
};
pos dir[] = {
    {1, 0},
    {-1, 0},
    {0, 1},
    {0, -1}
};

int main(){
    int H, W;
    int nw = 0;
    int count = 0;
    vector<vector<char>> map;
    vector<vector<int>> depth;
    queue<pos> dest;
    cin >> H >> W;
    map.resize(H, vector<char>(W));
    depth.resize(H, vector<int>(W, -1));
    for (int i = 0; i < H; i++)
    {
        string str;
        cin >> str;
        for (int j = 0; j < W; j++){
            char c = str[j];
            if(c == '.'){
                nw++;
            }
            map[i][j] = str[j];
        }
    }
    dest.push({0, 0});
    depth[0][0] = 1;
    while(dest.size() != 0){
        pos now = dest.front();
        dest.pop();
        for (int i = 0; i < 4; i++){
            pos next = {now.x + dir[i].x, now.y + dir[i].y};
            if (next.x < 0 || H <= next.x || next.y < 0 || W <= next.y){
                continue;
            }
            if(map[next.x][next.y] == '#'){
                continue;
            }
            if(depth[next.x][next.y] != -1){
                continue;
            }

            if((next.x == H - 1) && (next.y == W - 1)){
                count++;
                int point = nw - depth[now.x][now.y] - 1;
                cout << point << endl;
                return 0;
            }
            count++;
            dest.push(next);
            depth[next.x][next.y] = depth[now.x][now.y] + 1;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import product
import numpy as np

N, M, X = list(map(int, input().split()))
INF = 10**5 * 12 + 1
books = np.array([list(map(int, input().split())) for i in range(N)])
ans = INF
for selection in product([0, 1], repeat=N):
    selection = np.array(selection).reshape(N, 1)
    res = (books * selection).sum(axis=0)
    if min(res[1:]) >= X:
        ans = min(ans, res[0])
print(ans if ans != INF else -1)

Measured memory_bytes: 27284
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
//const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){cout << a << " " << b << " " << c << endl;}
#define INT_MAX 1<<30;
const int MAX = 1020000;
const double EPS = 1e-6;
const int mod = 1e9+7;

int main(){
    ll n; cin >> n;
    if(n%2==1) puts("0");
    else{
        ll ans = 0;
        ll t = 10;
        while(n>=t){
            ans += n/t;
            t *= 5;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stack>
using namespace std;
int main(){
  stack<int> st;
  int d;
  while(cin >> d){
    if(d == 0){
      cout << st.top() << endl;
      st.pop(  );
    }else {
      st.push( d );
    }
  }
}

Measured memory_bytes: 1200
using System;

namespace AtCoder
{
    class Program
    {
        static void Main ( string[] args )
        {
            var s = Console.ReadLine ( );
            if (s =="ABC")
            {
                Console.WriteLine ( "ARC" );
            }
            else if (s=="ARC")
            {
                Console.WriteLine ( "ABC" );
            }

        }
    }
}


Measured memory_bytes: 25892
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    string S;
    cin >> S;
    
    int cnt = 0;
    for(int i=0;i<S.length();i=i+2){
        if(S[i]=='R' || S[i]=='U' || S[i]=='D'){
            cnt++;
        }
    }
    for(int i=1;i<S.length();i=i+2){
        if(S[i]=='L' || S[i]=='U' || S[i]=='D'){
            cnt++;
        }
    }
    if(cnt == S.length()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}




Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main{
	static int mod = 1000000000 + 7;
	static int N;
	static double[][][] dp;
	static double rec(int i, int j, int k) {
		if(dp[i][j][k] != -1) return dp[i][j][k];
		if(i == 0 && j == 0 && k == 0) return 0;
		double ret = N;
		if(i > 0) ret += rec(i - 1, j, k) * (double)i;
		if(j > 0) ret += rec(i + 1, j - 1, k) * (double)j;
		if(k > 0) ret += rec(i, j + 1, k - 1) * (double)k;
		ret = ret / ((double)(i + j + k));
		return dp[i][j][k] = ret;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			N = sc.nextInt();
			dp = new double[301][301][301];
			for(int i = 0; i <= 300; i++) for(int j = 0; j <= 300; j++) Arrays.fill(dp[i][j], -1);
			int one = 0, two = 0, three = 0;
			for(int i = 0; i < N; i++) {
				int a = sc.nextInt();
				if(a == 1) one++;
				else if(a == 2) two++;
				else if(a == 3) three++;
			}
			System.out.println(rec(one, two, three));
		}
	}
}

Measured memory_bytes: 305492
#include<bits/stdc++.h>
using namespace std;
//freopen("input.txt" , "r" , stdin);
//freopen("output.txt" , "w" , stdout);
#define ll            long long
#define endl          '\n'
//ll ans=floor(y*log10(x))+1;   number of digits in x^y
//for(ll i=1;i<1000000;i++)for(ll j=i;j<1000000;j+=i)divisors[j]++;  counting divisors or NOD(1 to N) ..its works like as prime_factorizations...
//for(ll i=1;i<1000000;i++)for(ll j=i;j<1000000;j+=i)sum_of_divisors[j]+=i;  sum of divisors ... sum_of_divisors(6)=1+2+3+6=12......
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define w(x)          ll x;cin>>x;while(x--)
#define IOS           ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i,n)      for(ll i=0;i<n;i++)
#define REP1(i1,n)    for(ll i=1;i<n;i++)
#define pb             push_back
#define mk             make_pair
#define ff             first
#define ss             second
const double pi = acos(-1.0);
#define  mpee            map<ll,ll>
#define  v             vector<ll>
#define  be            begin()
#define  e             end()
#define mod            1000000007
#define Max              100009s
int main()
{
string st;
cin>>st;
ll ans=0;
for(ll i=0;i<st.size();i++)
{
    ans+=st[i]-'0';
}
if(ans%9==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
//for(ll i=0;i<len;i++)cout<<v[i]<<" ";
/*

Alhamdulilla...

*/


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline int readint() {
	char c = getchar(); int w = 1; int x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 3) + (x << 1) + (c ^ '0'), c = getchar();
	x *= w;
	return x;
}
inline ll readll() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 3) + (x << 1) + (c ^ '0'), c = getchar();
	x *= w;
	return x;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
struct node{int x,y;};
int h,w,k,xx1,yy1,x2,y2;
bool ok(int x,int y){
	if(x<=h&&x>=1&&y<=w&&y>=1)return true;
	else return false;
}
queue<node>Q;
int main(){
	cin>>h>>w>>k;
	char g[h+1][w+1];
	int vis[h+1][w+1],step[h+1][w+1];
	memset(vis,0,sizeof(vis));
	memset(step,0,sizeof(step));
	cin>>xx1>>yy1>>x2>>y2;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>g[i][j];
		}
	}
	node a,b;
	a.x=xx1,a.y=yy1;
	step[xx1][yy1]=0;
	vis[xx1][yy1]=1;
	Q.push(a);
	int ans=bql;
	while(!Q.empty()){
		a=Q.front();
		Q.pop();
		if(a.x==x2&&a.y==y2){
			ans=min(ans,step[x2][y2]);
		}
		for(int i=0;i<4;i++){
			for(int j=1;j<=k;j++){
				b.x=dx[i]*j+a.x;
				b.y=dy[i]*j+a.y;
				if(ok(b.x,b.y)==0||(step[b.x][b.y]<=step[a.x][a.y]&&step[b.x][b.y]))break;
				else{
					if(g[b.x][b.y]=='@')break;
					if(g[b.x][b.y]=='.'&&!vis[b.x][b.y]){
						vis[b.x][b.y]=1;
						step[b.x][b.y]=step[a.x][a.y]+1;
						Q.push(b);
					}
				}
			}
		}
	}
	if(ans==bql)cout<<-1<<endl;
	else cout<<ans<<endl;
	return 0;
}
/* stuff to remember
	* int overflow, array bounds
	* special cases (n=1? n=0?)
	* do something instead of nothing and stay organized
	* USE STATIC ARRAYS
	* DEFINING ARRAYS BEFORE main()
	* DO NOT DEFINE ARRAYS IN main()
	* USE INT INSTEAD OF LL,NOTICE THE MLE
*/

Measured memory_bytes: 20240
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	AtCoder::Str str = data->getStr();
	AtCoder::Str S = str;
	AtCoder::exp(&S[0], &S);

	data->getInput();
	str = data->getStr();

	AtCoder::Str T = str;
	AtCoder::exp(&T[0], &T);

	const int disize = 0 == (S.size() - T.size()) ? 1 : (S.size() - T.size());

	int dians = T.size();

	for (int i = 0; i < disize; i++) {
		int buf = 0;
		for (int j = 0; j < T.size(); j++) {
			if (S[(i + j)] != T[j]) {
				buf++;;
			}
		}
		if (dians > buf) {
			dians = buf;
		}
	}

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

	delete(data);

	return 0;
}

Measured memory_bytes: 3252
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,a[110000];
	cin>>n;
	rep(i,n) cin>>a[i];
	
	int ans[110000];
	int kari=a[0];
	int koukan=0;
	
	for(int i=1;i<n;i++){
		if(a[i]<=kari){
			ans[koukan]++;
		}
		else{;
			koukan++;
		}
		kari=a[i];
	}
	
	sort(ans,ans+(koukan+1));
	reverse(ans,ans+(koukan+1));
	
	cout<<ans[0]<<endl;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(20000)

field = []
w = 0
h = 0


def main():
    global field, w, h
    while True:
        h, w = map(int, input().split())
        if h == 0 and w == 0:
            break
        count = 0
        field = []
        [field.append(list(input())) for _ in range(h)]
        for y in range(h):
            for x in range(w):
                if field[y][x] != -1:
                    dfs(field[y][x], x, y)
                    count += 1
        print(count)


def dfs(kind, x, y):
    global field
    field[y][x] = -1
    for dx, dy in zip([0, 0, -1, 1], [1, -1, 0, 0]):
        next_x = x + dx
        next_y = y + dy
        if next_x < 0 or next_y < 0 or next_x >= w or next_y >= h \
                or field[next_y][next_x] != kind:
            continue
        dfs(field[next_y][next_x], next_x, next_y)


if __name__ == '__main__':
    main()

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
long long fast(long long x,int k)
{
	if(k==0) return 1;
	long long c=fast(x,k/2);
	if(k%2==0) return (c*c)%MOD;
	return (((c*c)%MOD)*x)%MOD;
}
long long mmi(long long x) {return fast(x,MOD-2);}
long long fkt[1000007];
int main()
{
	int x,y; cin>>x>>y;
	if((x+y)%3!=0 || 2*y<x || 2*y-x>x+y) {printf("0"); return 0;}
	long long a=(2*y-x)/3,c=(x+y)/3;
	fkt[0]=1;
	for(long long i=1;i<=1000000;i++) fkt[i]=(fkt[i-1]*i)%MOD;
	cout<<(((fkt[c]*mmi(fkt[a]))%MOD)*mmi(fkt[c-a]))%MOD;
}

Measured memory_bytes: 8192
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

std::vector<long long> divisor(long long n) {
  std::vector<long long> res;
  for (long long i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      res.push_back(i);
      if (i * i != n)
        res.push_back(n / i);
    }
  }
  std::sort(res.begin(), res.end());
  return res;
}

int main() {
  long long N;
  std::cin >> N;

  long long res = 0;
  std::vector<long long> ds = divisor(N);
  for (auto v : ds) {
    if (v == 1)
      continue;

    long long m = v - 1;
    if (N / m == N % m)
      res += m;
  }

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 384
////////////
//||||| ||// 
//   || ||//
//||||||||//
//|| ||   //
//|| |||||//
////////////
#include<bits/stdc++.h>
using namespace std;
#define   ll  long long int
#define   dl double
#define   llu unsigned long long int
#define   scll(x) scanf("%lld",&x)
#define   scld(x) scanf("%lf",&x)
#define   scull(x) scanf("%llu",&x)
#define   scch(x) scanf(" %c",&x)
#define   pb(x) push_back(x)
#define   pf(x) push_front(x)
#define   ppb() pop_back()
#define   ppf() pop_front()
#define   Pi acos(-1.0)
#define   inf 1000000000000000000
#define   mod 1000000007
#define   ff first
#define   ss second
#define   mpr make_pair
#define   debug(x) cout<<x<<'\n';
#define   MAX 1000000
#define   eps 1e-8
// Creates a min heap
//priority_queue <int, vector<int>, greater<int> > pq;
//sin((x*pi)/180.0)[x in degree]
//sin(x)[x in radian]
//asin(x)[radian]
//(asin(x)*180)/pi[degree]
//or(|)//and(&)//xor(^)//not(~)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll lcm(ll a, ll b) {return (a * b) / __gcd(a, b);}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll a, b, c = 0, d, e, f = 0, g, h, i, j, k, m, n, o, p, s, t, v, w, x, y, z,l;
    ll cnt = 0, l1 = 0, l2, l3, c1 = 0, c2 = 0, c3 = 0, mx = 0, mn = 0;
    ll prevsum = 0, ans1 = 0, ans2 = 0, odd = 0, even = 0, hh, mm;
    string str, str1, str2, str3 = "", str4 = "";
    ll ide = 0, idx = 0, Q;
    
    scll(x);
    scll(k);
    scll(d);
    if(x<0)
    	x=-x;
    l1=x%d;
    if(k>=x/d)
    {
      l2=k-(x/d);
      if(l2%2==0)
      	cout<<l1<<'\n';
      else
      	cout<<min(l1+d,abs(l1-d))<<'\n';
    }
    else
    	cout<<x-k*d<<'\n';
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int go(int n, int s, int used) {
	if (n == 0) {
		return s == 0;
	}
	if (s < 0) return 0;
	if (s - 9 * n * n > 0) return 0;
	
	int res = 0;
	rep(i, 10) if (!(used & 1 << i)) {
		res += go(n - 1, s - n * i, used | 1 << i);
	}
	
	return res;
}

int main() {
	for (int n, s; cin >> n >> s; ) {
		cout << go(n, s, 0) << endl;
	}
	return 0;
}

Measured memory_bytes: 864
import java.util.*;
import java.math.*; 
public class Main {
	public static void main(String[] args) {
		MathContext mc = new MathContext(25, RoundingMode.HALF_DOWN);
		Scanner in=new Scanner(System.in);
        int n = in.nextInt();
        int a = in.nextInt();
        int x = in.nextInt();
        BigDecimal L= new BigDecimal(1); 
        BigDecimal ans= new BigDecimal(2*x);
        for(int i=2;i<=n;++i)
        {
        	BigDecimal t=new BigDecimal(i);
        	L=L.add(BigDecimal.ONE.divide(BigDecimal.valueOf(i),mc));
        	t=L.add(BigDecimal.valueOf(i));
        	t=t.multiply(BigDecimal.valueOf(x));
        	BigDecimal t2=ans.multiply(BigDecimal.valueOf(2)).divide(BigDecimal.valueOf(i),mc);
        	ans=ans.add(t).add(t2);
        }
        L=L.add(BigDecimal.ONE.divide(BigDecimal.valueOf(n+1),mc));
        L=L.subtract(BigDecimal.ONE);
        L=L.multiply(BigDecimal.valueOf(n+1)).multiply(BigDecimal.valueOf(2*a-3*x));
        L=L.divide(BigDecimal.valueOf(2),mc);
        ans=ans.add(L);
        System.out.print(ans);
	}
}

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

s = input().rstrip()
N = len(s)

for i in range(N):
    if i + 2 >= N:
        continue
    if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i + 2] == s[i]:
        print(i + 1, i + 3)
        sys.exit()

if s[-1] == s[-2]:
    print(N - 1, N)
    sys.exit()

print(-1, -1)

Measured memory_bytes: 39408
N=int(input())


X=[1]+[6**i for i in range(1,7)]+[9**i for i in range(1,6)]
X.sort()
X.reverse()


DP=[i for i in range(100001)]

def dpmin(i):
    Y=i
    for j in X:
      if i-j>=0:
        Y=min(Y,DP[i-j]+1)

    return Y

for i in range(100001):
    DP[i]=dpmin(i)

print(DP[N])
    

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

const long long mod = 1e9 + 7;

long long modpow(long long a, long long b) {
	if (b == 0) return 1;
	return modpow(a * a % mod, b / 2) * (b & 1 ? a : 1) % mod;
}

void dfs(int x, string a, vector<string> &res) {
	if (x == 0) {
		res.push_back(a);
		return;
	}
	for (int i = 1; i <= x; i++) {
		dfs(x - i, a + string(1, i + '0'), res);
	}
}

const int N = 1e5;
int succ[N][26];
int fail[N];
bool accept[N];
int pos = 1;

void add(string s) {
	int curr = 0;
	for (char c : s) {
		c -= '1';
		if (succ[curr][c] == 0) {
			succ[curr][c] = pos++;
		}
		curr = succ[curr][c];
	}
	accept[curr] = true;
}

void build_aho_corasick() {
	queue<int> q;

	for (int c = 0; c < 26; c++) {
		if (succ[0][c] != 0) {
			q.push(succ[0][c]);
		}
	}

	while (!q.empty()) {
		int curr = q.front(); q.pop();

		for (int c = 0; c < 26; c++) {
			if (succ[curr][c] == 0) continue;
			int next = succ[curr][c];

			q.push(next);

			int v = fail[curr];
			while (v != 0 && succ[v][c] == 0) v = fail[v];
			fail[next] = succ[v][c];
		}
	}
}

int main() {
	int N, X, Y, Z;
	cin >> N >> X >> Y >> Z;
	vector<string> a, b, c;
	dfs(X, "", a);
	dfs(Y, "", b);
	dfs(Z, "", c);

	vector<string> P;
	for (string x : a) {
		for (string y : b) {
			for (string z : c) {
				P.emplace_back(x + y + z);
				add(P.back());
			}
		}
	}
	build_aho_corasick();

	int K = pos;

	vector<vector<int>> next(K, vector<int>(10));

	for (int i = 0; i < K; i++) {
		for (int j = 0; j < 10; j++) {
			int ni = i;
			while (ni != 0 && succ[ni][j] == 0) {
				ni = fail[ni];
				accept[i] |= accept[ni];
			}
			ni = succ[ni][j];
			next[i][j] = ni;
		}
	}

	vector<vector<long long>> dp(N + 1, vector<long long>(K));
	dp[0][0] = 1;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < K; j++) {
			if (accept[j]) continue;
			for (int k = 0; k < 10; k++) {
				if (accept[next[j][k]]) continue;
				(dp[i + 1][next[j][k]] += dp[i][j]) %= mod;
			}
		}
	}

	long long ans = modpow(10, N);
	for (int i = 0; i < K; i++) {
		(ans += mod - dp[N][i]) %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 18432
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    vector<int> a(3);
    for(int i = 0; i < 3; ++i) {
        cin >> a[i];
    }
    #define all(x) (x).begin(), (x).end()
    cout << accumulate(all(a), 0) - *max_element(all(a)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

vector<ll> ans(100005);
vector<ll> visited(100005,-1);
vector<vector<ll>> graph(100005,vector<ll>());
map<pll,ll> mp;

void dfs(ll from, ll v){
    visited[v] = 1;
    ll color = 1;
    for(int i = 0; i < graph[v].size(); i++){
        if(visited[graph[v][i]] != -1){
            continue;
        }else{
            if(color==from){
                color++;
            }
            ans[mp[{v,graph[v][i]}]] = color;
            dfs(color, graph[v][i]);
            color++;
        }
    }
    return;
}

int main(){
    ll n;
    cin >> n;
    for(int i = 0; i < n-1; i++){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        mp[{a,b}] = i;
        mp[{b,a}] = i;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    dfs(0, 0);
    ll max_color = 0;
    for(int i = 0; i < n-1; i++){
        max_color = max(max_color, ans[i]);
    }
    cout << max_color << endl;
    for(int i = 0; i < n-1; i++){
        cout << ans[i] << endl;
    }
    return 0;

}


Measured memory_bytes: 20608
#include <stdio.h>

int main()
{
    int n,k;
    scanf("%d",&n);
    char s[n];
    scanf("%s",s);
    scanf("%d",&k);
    
    for(int i=0;i<n;i++){
        if(s[i] != s[k-1]){
            s[i] = '*';
        }
    }
    printf("%s",s);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll N, M;
  cin >> N >> M;
  ll A[N];
  rep(i, N){
    cin >> A[i];
    A[i] %= M;
  }
  ll S[N+1];
  S[0] = 0;
  rep(i, N){
    S[i+1] = S[i]+A[i];
    S[i+1] %= M;
  }
  sort(S, S+N+1);
  ll ans = 0, cnt = 1;
  rep(i, N){
    if(S[i+1] == S[i]) cnt++;
    else{ans += cnt*(cnt-1)/2; cnt=1;}
  }
  ans += cnt*(cnt-1)/2; 
  cout << ans << endl;
  }

Measured memory_bytes: 1792
#include <stdio.h>
 
int main(){
  int score[2][5]= {{0},{0}}, i, j;
 
  for(i = 0; i < 2;i++){
    for(j = 0; j < 4;j++){
      scanf("%d", &score[i][j]);
      score[i][4] += score[i][j];
    }
  }
 
  if(score[0][4] > score[1][4])
    printf("%d\n", score[0][4]);
  else
    printf("%d\n", score[1][4]);
 
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

int main() {
 vector<int> v(3);
 for(int i = 0;i<3;i++){
	 cin >> v[i];
 }
sort(v.begin(),v.end());
int ans = 0;
if(v[0] == v[1]) ans = v[2];
if(v[1] == v[2]) ans = v[0];

cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>

#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main()
{
	int a, b, calc;
	string op;

	//？がでるまで読み込む
	while (1) {
		cin >> a >> op >> b;
		if (op == "?") {
			break;
		}
		if (op == "+") {
			calc = a + b;
		}
		if (op == "-") {
			calc = a - b;
		}
		if (op == "*") {
			calc = a * b;
		}
		if (op == "/") {
			calc = a / b;
		}
		cout << calc << endl;
	}
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, c;
  string S;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S != "Y")continue;
    else{
      cout << "Four" << endl;
      break;
    }
  }
  if(S != "Y")cout << "Three" << endl;
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N;
    ll K;
    cin >>N>>K;

    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    
    //-----------------------------------
    ll x=0,ans=0;
    int st=(K==0) ? -1 :log2(K)+1;
    for(int i=st;i>=0;i--){
        ll xi=1LL<<i;
        if((x|xi)>K)continue;
        int cnto=0;
        rep(i,N)if(A[i]&xi)cnto++;
        if(cnto < N-cnto)x|=xi;
    }
    rep(i,N)ans+=A[i]^x;

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

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  	int n;
  	cin >> n;
  	int a[n],sum=0;
  	for(int i=0;i<n;i++)
    {cin >> a[i]; sum+=a[i];}

  	int m,t;
  	cin >> m;
  	for(int i=0;i<m;i++){
      t=sum;
      int x,y;
      cin >> x >> y;
      t = sum-a[x-1]+y;
      cout << t <<"\n";
    }
    return 0;
}

Measured memory_bytes: 3652
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func StrStdin() (stringReturned string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput := scanner.Text()

	stringReturned = strings.TrimSpace(stringInput)
	return
}

func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}

	return
}

func SplitStrStdin(delim string) (stringReturned []string) {
	// 文字列で1行取得
	stringInput := StrStdin()

	// 空白で分割
	// stringSplited := strings.Split(stringInput, delim)
	stringReturned = SplitWithoutEmpty(stringInput, delim)

	return
}

func SplitIntStdin(delim string) (intSlices []int, err error) {
	// 文字列スライスを取得
	stringSplited := SplitStrStdin(" ")

	// 整数スライスに保存
	for i := range stringSplited {
		var iparam int
		iparam, err = strconv.Atoi(stringSplited[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

func main() {
	var n int
	fmt.Scanf("%d", &n)

	// get params
	w, err := SplitIntStdin(" ")
	if err != nil {
		fmt.Println(err)
	}

	// get sum
	var sum int
	for _, i := range w {
		sum += i
	}
	half := sum / 2

	var result int
	var tmpSum int
	var challangeSum int
	for _, num := range w {
		if (tmpSum != 0) {
			if (int(math.Abs((float64)(tmpSum) - (float64)(half))) < int(math.Abs((float64)(challangeSum) - (float64)(half)))) {
				result = int(math.Abs((float64)(sum-tmpSum) - (float64)(tmpSum)))
			} else {
				result = int(math.Abs((float64)(sum-challangeSum) - (float64)(challangeSum)))
			}
			break
		}

		// 半分超える場合は値を保持
		if (challangeSum+num > half) {
			tmpSum = challangeSum
		}
		challangeSum += num
	}

	fmt.Printf("%d\n", result)
}


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

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	long long int K,T,N,M,P,Q,i,j,k,a,b;
	cin>>K;
	
	a=K/2;
	b=K-a;
	
	cout<<a*b<<endl;
    
    
    return (0);
}

Measured memory_bytes: 764
#include <iostream>
#include <math.h>

using namespace std;

//?????°?±?????????¢??°Figure
int Figure(int a, int b){
    //a+b=0???????????????
    if((a+b) == 0){
        return 1;
    }
    else {
        int figure = (int) log10(a + b) + 1;
        return figure;
    }
}

int main(){
    int a = 0, b = 0;
    //????????????????????????????????° count
    int count = 0;
    //??????????´???????ans?????¨????????????200??¨???
    int ans[200];

    while(cin >> a >> b){
        ans[count] = Figure(a, b);
        count++;
    }

    for(int i = 0; i < count; i++){
        cout << ans[i] << endl;
    }

    return 0;

}

Measured memory_bytes: 3312
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(){
  int n;
  std::cin >> n;

  std::vector<ll> a(n);
  std::vector<ll> w(n,0);

  rep(i,n){
    ll temp;
    std::cin >> temp;
    a[i]=temp;
    while (temp/2>0 && temp%2==0) {
      temp/=2;
      w[i]++;
    }
  }

  ll ans=0;
  rep(i,n)ans+=w[i];
  std::cout << ans << '\n';

  return 0;
}


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

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

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

    ll ans = 1 + n;
    for (ll i = 1; i * i <= n; i++) {
        ll a = i;
        ll b = n / i;
        if (a * b == n) {
            ans = min(ans, a + b - 2);
        }
    }

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

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin >> s;
  int n = s.length();
  if(s[n - 1] == '3') cout << "bon" << endl;
  else if(s[n - 1] == '0' || s[n - 1] == '1' || s[n - 1] == '6' || s[n - 1] == '8') cout << "pon" << endl;
  else cout << "hon" << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	vector<ll> A(N), B(N), C(N);
	priority_queue<ll, vector<ll>, greater<ll>> qa;
	priority_queue<ll> qc;

	for(auto &a : A) {
		cin >> a;
		qa.push(a);
	}
	for(auto &b : B) cin >> b;
	for(auto &c : C) {
		cin >> c;
		qc.push(c);
	}

	sort(A.begin(), A.end());
	sort(C.begin(), C.end());

	vector<ll> suml(N+1), sumr(N+1);
	suml[0] = accumulate(A.begin(), A.end(), 0LL);
	sumr[0] = accumulate(C.begin(), C.end(), 0LL);

	for(int i=0;i<N;i++) {
		// 和を大きく
		ll amin = qa.top();
		if (amin < B[i]) {
			suml[i+1] = suml[i] - amin + B[i];
			qa.pop();
			qa.push(B[i]);
		} else {
			suml[i+1] = suml[i];
		}
		// 和を小さく
		ll cmax = qc.top();
		if (cmax > B[N-1-i]) {
			sumr[i+1] = sumr[i] - cmax + B[N-1-i];
			qc.pop();
			qc.push(B[N-1-i]);
		} else {
			sumr[i+1] = sumr[i];
		}
	}

  	ll ans = LLONG_MIN;
	for(int i=0;i<=N;i++) {
		ans = max(ans, suml[i] - sumr[N-i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 5876
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define int ll

ll n,k,sum;
vector<ll> a;

bool f(int idx){
    bool dp[5001]={};
    dp[0]=true;
    rep(i,n){
        if(i==idx) continue;
        for(int j=5000;j>=0;j--){
            if(dp[j] and j+a[i]<=5000){
                dp[j+a[i]]=true;
            }
        }
    }
    bool f=true;
    for(int i=k-1;i>=0;i--)if(dp[i]){
        if(i+a[idx]>=k) f=false;
    }

    // cout<<idx<<" "<<a[idx]<<" : "<<f<<endl;
    // rep(i,8)cout<<i<<" : "<<dp[i]<<endl;
    return f;
}

int ans=-1;
void solve(int l,int r){
    if(l>r) return ;
    int mid=(l+r)/2;
    if(f(mid)){
        chmax(ans,mid);
        solve(mid+1,r);
    }else{
        solve(l,mid-1);
    }
}

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

    cin>>n>>k;
    a.resize(n);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    sort(ALL(a));
    if(sum<k){
        cout<<n<<endl;
        return 0;
    }
    solve(0,n-1);
    cout<<ans+1<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch DigitalGifts | diff DigitalGifts.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address DigitalGifts.cpp && ./a.out

/*
 
 3/11/2019
 
 14:34-
 
 */
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  double res=0;
  int N; cin>>N;
  REP(i,N) {
    double x; string u; cin>>x>>u;
    if(u!="JPY") x*=380000.0;
    res+=x;
  }
  cout<<res<<endl;
  
  return 0;
}


Measured memory_bytes: 256