akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <stack>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,n,s) for(int i=(int)(s);i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int n,m;cin>>n>>m;
    vector<vector<int>> e(n, vector<int>(0));
    REP(i,m) {
        int a,b;cin>>a>>b;
        a--;b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }

    int ans = 0;
    stack<vector<int>> s;
    s.push(vector<int>(1,0));
    while(!s.empty()) {
        vector<int> path = s.top();
        s.pop();

        FOR(i, e[path.back()]) {
            if(find(ALL(path), *i) != path.end()) continue;
            if(path.size()+1 == n) {
                ans++;
                continue;
            }
            path.push_back(*i);
            s.push(vector<int>(path));
            path.pop_back();
        }
    }

    cout << ans << endl;
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b=MI()
    
    if a<=0<=b:
        print("Zero")
    
    elif a>0 and b>0:
        print("Positive")
    else:
        if b>0:
            b=-1
        n=(b-a+1)
        if n%2==0:
            print("Positive")
        else:
            print("Negative")

main()


Measured memory_bytes: 61940
#include <atcoder/lazysegtree>
#include <atcoder/modint>

#include <bits/stdc++.h>


using namespace std;

using ll = long long;
using mint = atcoder::modint998244353;

struct S {
    mint val, weight;
};

S op(S a, S b) {
    return {a.val+b.val, a.weight+b.weight};
}

S e() {
    return {0, 0};
}

typedef int F;

const F ID = -1;

S mapping(F f, S a) {
    if (f == ID) return a;

    return {f*a.weight, a.weight};
}

F composition(F f, F g) {
    return f == ID ? g : f;
}

F id() {
    return ID;
}


int main(int argc, char const *argv[])
{
    int n, q;
    scanf("%d%d", &n, &q);

    vector<S> arr(n, {1, 1});

    for (int i = n-2; i >= 0; --i) {
        arr[i] = {arr[i+1].val*10, arr[i+1].weight*10};
    }

    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> segTree(arr);

    for (int i = 0; i < q; ++i) {
        int l, r, d;
        scanf("%d%d%d", &l, &r, &d);

        segTree.apply(l-1, r, d);

        int ans = segTree.all_prod().val.val();
        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 9864
#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(){
  int N; cin >> N; string S; cin >> S;
  char T[1000][3]; int cnt = 0;
  rep(i, 10){
    rep(j, 10){
      rep(k, 10){
        T[cnt][0] = i + '0'; T[cnt][1] = j+ '0'; T[cnt][2] = k+ '0'; cnt++;
      }
    }
  }
  int ans = 0;
  rep(i, 1000){
   int j=0, k=0;
   while(k<3 && j<N){
     if(T[i][k]==S[j]){
       k++; 
     }
     j++;
   }
   if(k==3) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main(){
	char A[3][120],mark[2];
	int num[3]={0,0,0},index=0;

	strcpy(mark,"a");
	cin >> A[0];
	cin >> A[1];
	cin >> A[2];
	while(mark[0]=='a'||mark[0]=='b'||mark[0]=='c'){
		if(mark[0]=='a'){
			index = 0;
		}else if(mark[0]=='b'){
			index = 1;
		}else{
			index = 2;
		}
			mark[0]=A[index][num[index]];
			num[index]++;
	}
	switch (index){
		case 0:cout<<"A";break;
		case 1:cout<<"B";break;
		case 2:cout<<"C";break;
	}
}

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

using namespace std;

void Main() {
    int N;
    cin >> N;
    if (N <= 999) {
        cout << "ABC" << endl;
    }
    else {
        cout << "ABD" << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-10;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int n;
vector<int> a;
double dp[400][400][400];

double dfs(int i, int j, int k) {
    if(dp[i][j][k] >= 0) {
        return dp[i][j][k];
    }
    if(i == 0 && j == 0 && k == 0) {
        return 0.0;
    }
    double res = n;
    if(i >= 1) {
        res += dfs(i - 1, j, k) * i;
    }
    if(j >= 1) {
        res += dfs(i + 1, j - 1, k) * j;
    }
    if(k >= 1) {
        res += dfs(i, j + 1, k - 1) * k;
    }
    res /= (double)(i + j + k);
    return dp[i][j][k] = res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    memset(dp, -1, sizeof(dp));
    cin >> n;
    a.resize(n);
    int p = 0, q = 0, r = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] == 1) {
            p++;
        } else if(a[i] == 2) {
            q++;
        } else {
            r++;
        }
    }
    cout << fixed << setprecision(15);
    cout << dfs(p, q, r) << endl;
}

Measured memory_bytes: 500352
n = int(input())
a = str(input())

w_list = [0 for i in range(n+1)]
r_list = [0 for i in range(n+1)]

w = 0
r = 0
f = True
for i in range(1,n+1):
    if a[i-1] == "W":
        w += 1
        if w == 1:
            f = True
    else:
        f = False
    w_list[i] = w

for i in range(n-1,-1,-1):
    if a[i] == "R":
        r += 1
    r_list[i] = r

if w==0 or r == 0 or f == True:
    print(0)
    exit()

ans = n
for i in range(n+1):
    ans = min(ans,max(w_list[i],r_list[i]))
print(ans)

Measured memory_bytes: 18844
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int t=m;
    int now=1;
    int k=m/n;
    int i;
    if(n==1)
        now=m;
    else
    for(i=k;i>=2;i--)
    {
        if(m%i==0&&t/(now*i)>=n)
        {
            m=m/i;
            now*=i;
            i++;
        }
    }
    cout<<now;
    return 0;
}


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

int main() {
  int N;
  int ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 2000000000
#define PI 3.14159265358979323846
using namespace std;
bool over(long long x, long long y)
{
	long long res=x*y;
	if(x == res/y)
		return false;
	return true;
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	long long c=1, lim=1000000000000000000LL;
	int n;
	cin >> n;
	long long a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a+n);
	c=a[0];
	if(a[0]==0LL)
	{
		cout << "0\n";
		return 0;
	}
	for(int i = 1; i < n; i++)
	{
		if(a[i] > lim/c)
		{
			cout << "-1\n";
			return 0;
		}
		c*=a[i];
	}
	if(c > lim)
	{
		cout << "-1\n";
		return 0;
	}
	cout << c << '\n';
}

Measured memory_bytes: 4428
#include <iostream>
#include <algorithm>
#include <vector>
#define int long long
using namespace std;

signed main() {
  int N; cin >> N;
  vector<int> A(N), B(N), C(N);
  for(int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
    C[i] = B[i] - (A[i] % B[i]);
  }
  reverse(A.begin(), A.end());
  reverse(B.begin(), B.end());
  reverse(C.begin(), C.end());
  int cnt = 0;
  for(int i = 0; i < N; ++i) {
    int cur = A[i] + cnt;
    if(cur % B[i] == 0) {
      cnt += 0;
    } else {
      cnt += B[i] - (cur % B[i]);
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
long long shimen[200];
long long dp[1000010];
long long dp2[1000010];
int main () {
	long long N;
	for (long long n = 1; n * n * n < 6000000; n++) {
		shimen[n] = n * (n + 1) * (n + 2) / 6;
		N = n;
	}
	
	for (int i = 1; i < 1000001; i++) {
		dp[i] = 100000;
		dp2[i] = 100000;
	}
	dp[0] = 0;
	for (long long i = 0; i < 1000001; i++) {
		for (int j = 0; j < N; j++) {
			if (shimen[j] + i > 1000001) continue;
			dp[i + shimen[j]] = min(dp[i + shimen[j]], dp[i] + 1);
			if (shimen[j] % 2) {
				dp2[i + shimen[j]] = min(dp2[i + shimen[j]], dp2[i] + 1);
			}
		}
	}
	cin >> N;
	while (N) {
		cout << dp[N] << " " << dp2[N] << endl;
		cin >> N;
	}
}
	


Measured memory_bytes: 18700
//package  com.company;

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n,m,k;
        n=sc.nextInt();
        m=sc.nextInt();
        k=sc.nextInt();
        sc.nextLine();
        int[] a=new int[n];
        int[] b=new int[m];
        for(int i=0;i<n;++i)a[i]=sc.nextInt();
        sc.nextLine();
        for(int i=0;i<m;++i)b[i]=sc.nextInt();
        int ans=0;
        long rem=0;
        for(int i=0;i<m;++i)rem+=b[i];
        long cur=0;
        int j=m-1;
        while(j>=0 && rem>k){rem-=b[j--];}
        if(j>=0)
        ans=Math.max(ans,j+1);
        for(int i=0;i<n;++i){
            cur+=a[i];
            if(cur>k)break;
            while(j>=0 && cur+rem>k){rem-=b[j--];}
            if(j<0 && rem==0 ){
                ans=Math.max(ans,i+1);
            }
            if(j>=0)
            ans=Math.max(ans,i+1+j+1);
        }
        System.out.println(ans);
    }
}

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


int main(){
    string s;
    cin >> s;
    
    int count=0;
    int ans=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            count++;
            ans = max(ans,count);
        }else{
            count = 0;
        }
        //cout << s[i];
    }
    //cout << endl;
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, A, B, C = map(int, input().split())
    l = [int(input()) for _ in range(N)]
    INF = 10 ** 9

    def dfs(cursor, a, b, c):
        if cursor == N:
            return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else INF

        no_compound_pattern = dfs(cursor+1, a, b, c)
        compound_a_pattern = dfs(cursor+1, a+l[cursor], b, c) + 10
        compound_b_pattern = dfs(cursor+1, a, b+l[cursor], c) + 10
        compound_c_pattern = dfs(cursor+1, a, b, c+l[cursor]) + 10

        return min(no_compound_pattern, compound_a_pattern, compound_b_pattern, compound_c_pattern)

    print(dfs(0, 0, 0, 0))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int A, B, C, X;
	int count = 0;

	Main(BufferedReader in) throws IOException {
		A = Integer.parseInt(in.readLine());
		B = Integer.parseInt(in.readLine());
		C = Integer.parseInt(in.readLine());
		X = Integer.parseInt(in.readLine());
	}

	void calc() {
		for (int i = 0; i <= A; ++i) {
			if (500 * i <= X) {
				int remain0 = X - 500 * i;
				for (int j = 0; j <= B; ++j) {
					if (100 * j <= remain0) {
						int remain1 = remain0 - 100 * j;
						if (remain1 % 50 == 0 && remain1 / 50 <= C) {
							++count;
						}
					}
				}
			}
		}
		System.out.println(count);

	}

	void showResult() {
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,K;
  cin>>A>>B>>K;
  if(B-A<=2*K-1){
    for(int i=A;i<=B;i++) cout<<i<<endl;
  }else{
    for(int i=A;i<=A+K-1;i++) cout<<i<<endl;
    for(int i=B-K+1;i<=B;i++) cout<<i<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN=500;
int main()
{
	long long x,tem;
	int k=1;
	cin>>x;
	long long pp[MAXN+3],pn[MAXN+3];
	for(int i=0;i<=MAXN;++i) 
		pp[i]=pow(i,5);
	for(int i=0;i<=MAXN;++i)
		pn[i]=-pp[i];
	/*for(int i=1;i<=MAXN;i++)
		cout<<p[i]<<endl;*/
	for(int i=0;i<=MAXN;++i)
	{
		tem=x+pp[i];
		if(binary_search(pp,pp+MAXN,tem))
		{
			cout<<lower_bound(pp,pp+MAXN,tem)-pp<<" "<<i<<endl;
			return 0;
		}
		tem=x-pp[i];
		if(binary_search(pp,pp+MAXN,tem))
		{
			cout<<lower_bound(pp,pp+MAXN,tem)-pp<<" "<<-i<<endl;
			return 0;
		}
		if(binary_search(pn,pn+MAXN,tem))
		{
			cout<<lower_bound(pn,pn+MAXN,tem)-pp<<" "<<-i<<endl;
			return 0;
		}
	}
	return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, a, n) for (int i = (a); i < (n); i++)
#define dep(i, n) for (int i = (n); i >= (0); i--)
#define deps(i, a, n) for (int i = (a); i >= (n); i--)
#define int long long

map<int, int> mp;
int n, a[4], k[3] = {2, 3, 5};

int func(int x)
{
	int n, tmp;

	if(x == 0)return 0;

	if(mp[x] != 0) return mp[x];
	if(x == 1) return mp[x] = a[3];

	if(x > 1e18 / a[3]) n = LLONG_MAX;
	else n = x * a[3];

	for (int i = 0; i < 3; i++)
	{
		tmp = x % k[i];
		n = min(n, func((x - tmp) / k[i]) + a[i] + tmp * a[3]);
		tmp = (k[i] - tmp) % k[i];
		n = min(n, func((x + tmp) / k[i]) + a[i] + tmp * a[3]);
	}

	return mp[x] = n;
}

signed main(void)
{
	int t;
	cin >> t;
	while (t--)
	{
		mp.clear();
		cin >> n >> a[0] >> a[1] >> a[2] >> a[3];
		cout << func(n) << endl;
	}
}


Measured memory_bytes: 4292
# -*- coding: utf-8 -*-

K, S = map(int, input().split())

ans = 0
for x in range(K+1):
    for y in range(K+1):
        # zは全部回さないで、Sを満たすようなものだけ用意する
        z = S - x - y
        # 候補となるzがKの範囲内であれば有効
        if 0 <= z <= K:
            ans += 1
print(ans)

Measured memory_bytes: 2940
#if 0
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D&lang=jp
#endif

#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <stack>
#include <vector>

using namespace std;

#define FOR(var, start, count) for(int var=start; var<count; var++)
#define REP(var, count) FOR(var,0,count)

int main(void) {
	string str;
	cin >> str;
	
	stack<int> stk;
	vector<pair<int, int> > kouho;
	
	
	REP(i, str.size()) {
		if ( str[i] == '\\' ) {
			stk.push(i);
		} else if ( str[i] == '/' ) {
			if ( stk.size() > 0 ) {
				int start = stk.top();
				stk.pop();
				
				int under = 0;
				while ( kouho.size() != 0 ) {
					pair<int, int> prev = kouho.back();
					if ( prev.first > start ) {
						kouho.pop_back();
						under += prev.second;
					} else {
						break;
					}
				}
				
				kouho.push_back( make_pair( start, under + i-start ) );
			}
		}
	}
	
	
	int sum = 0;
	REP(i, kouho.size()) { sum += kouho[i].second; }
	cout << sum << endl;
	
	cout << kouho.size();
	REP(i, kouho.size()) { cout << " " << kouho[i].second; }
	cout << endl;
	
}

Measured memory_bytes: 3324
import java.util.Scanner;

public class Main {

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

		int x = sc.nextInt();
		String ans = "";

		if (x < 1200) {
			ans ="ABC";
		} else {
			ans = "ARC";
		}

		System.out.println( ans );
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

int use[13];
int ans = 0;

void DFS(int depth, vector<int> vec){
    if(depth == 13){
        vec.push_back(24);
        sort(ALL(vec));
        int pre = 0, mn = INF;
        REP(i,vec.size()){
            mn = min(mn, vec[i] - pre);
            pre = vec[i];
        }
        ans = max(ans, mn);
        return;
    }
    if(use[depth] > 0){
        if(use[depth] > 1){
            vec.emplace_back(depth);
            vec.emplace_back(24 - depth);
            DFS(depth + 1, vec);
        }else{
            vec.emplace_back(depth);
            DFS(depth + 1, vec);
            if(depth != 0){
                vec.pop_back();
                vec.emplace_back(24 - depth);
                DFS(depth + 1, vec);
            }
        }
    }else{
        DFS(depth + 1, vec);
    }
}

signed main(){
    int n;
    cin >> n;
    int d;
    REP(i,n){
        cin >> d;
        use[d]++;
    }
    REP(i,13){
        if(use[i] > 2){
            cout << 0 << endl;
            return 0;
        }
    }
    DFS(0, vector<int>(0));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

const int mod = 1e9 + 7;
vector<int> comp;
int n, q, m;
int A[3001];
int p2[3001];

int T;
struct number {
    int x, t;
    number() : x(0), t(0) {}
    void update() {
        x = (llong)x * p2[T - t] % mod;
        t = T;
    }
};

number dp[3001][3001];

struct query {
    int x, y, v;
    query(int x, int y, int v) : x(x), y(y), v(v) {}
};

int ch[3001];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    p2[0] = 1;
    for (int i = 1; i <= 3000; ++i) p2[i] = p2[i - 1] * 2 % mod;
    cin >> n >> q;
    for (int i = 1; i <= n; ++i) {
        cin >> A[i];
        ch[i] = i;
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j < i; ++j) {
            if (A[i] != A[j]) {
                if (A[i] < A[j]) ++dp[i][j].x;
                else ++dp[j][i].x;
            }
        }
    }
    for (int it = 0; it < q; ++it) {
        int x, y;
        cin >> x >> y;
        ch[x] = y;
        ch[y] = x;
        vector<pii> P;
        vector<query> Q;
        for (int i = 1; i <= n; ++i) {
            P.emplace_back(x, i);
            P.emplace_back(y, i);
            if (i == x || i == y) continue;
            P.emplace_back(i, x);
            P.emplace_back(i, y);
        }
        for (pii i : P) dp[i.fs][i.se].update();
        for (pii i : P) {
            int v = dp[i.fs][i.se].x;
            i.fs = ch[i.fs];
            i.se = ch[i.se];
            Q.emplace_back(i.fs, i.se, v);
        }
        for (query q : Q) {
            dp[q.x][q.y].x += q.v;
            dp[q.x][q.y].x %= mod;
        }
        for (pii i : P) {
            ++dp[i.fs][i.se].t;
        }
        ch[x] = x;
        ch[y] = y;
        ++T;
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j < i; ++j) {
            dp[i][j].update();
            ans += dp[i][j].x;
            ans %= mod;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 71280
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b, c;
    int ans;
    
    scanf("%d%d%d", &a, &b, &c);
    
    if (a==b&&b==c) {
        ans=1;
    } else if (a==b||b==c||a==c) {
        ans=2;
    } else {
        ans=3;
    }
    
    printf("%d", ans);
    
    return 0;
}



Measured memory_bytes: 1704
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m, int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
	return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t, sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value, vector<ll> a)
{

	for (ll i = 0; i < (ll)a.size(); i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}
ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (ll j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}



int main() {
	int n; cin >> n;
	vector<string> s(n);
	rep(i, n)cin >> s[i];
	bool a = true;
	rep(i, n-1) {
		for(ll j=i+1;j<n;j++){
			if (s[i] == s[j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	rep(i, n - 1) {
		char b = s[i][s[i].size() - 1], c = s[i + 1][0];
		if (b != c) {
			cout << "No" << endl;
			return 0;
		}
	}
	if (a == true)cout << "Yes" << endl;
	return 0;
}













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

int main(void){
  int x, num, ans=1;
  cin >> x;
  for(int i=2; i<x; ++i){
    num = i*i;
    while(num<=x){
      ans = max(ans, num);
      num *= i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
N, M = [int(_) for _ in input().split()]

# 隣接関係は隣接リストで管理する
lst_edge = [[] for _ in range(N)]

for _ in range(M):
  # indexを0スタートにする。
  x, y = [int(_)-1 for _ in input().split()] 
  lst_edge[x].append(y)
        
# dp[v] := ノードvを始点とした時の有向パスの長さの最大値
# -1 未訪問で初期化。
dp = [-1] * N

# メモ化再帰
def rec(v):
  # 既に更新済み
  if dp[v] != -1:
    return dp[v]
  ans = 0
  lst_nv = lst_edge[v]
  for nv in lst_nv:
    ans = max(ans, rec(nv) + 1)
  dp[v] = ans
  return dp[v]
    
# 全ての点に対して更新する
ans = 0
for v in range(N):
  ans = max(ans, rec(v))
    
print(ans)
    

Measured memory_bytes: 59060
/**
*	  Name: Ajay Subhash Jadhav
*	  Institute: International Institute of Technology Hyderabad 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void inputread()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main(){
      
  fastio();
  int n,i;
  string s;
  stack<char> st;
  cin>>s;

  n=s.size();
  int ans=0;

  for(i=0;i<n;i++)
  {
  	if(st.empty())
  		st.push(s[i]);
  	else if(s[i]=='0' && st.top()=='1')
  	{
  		st.pop();
  		ans+=2;
  	}
  	else if(s[i]=='1' && st.top()=='0')
  	{
  		st.pop();
  		ans+=2;
  	}
  	else
  		st.push(s[i]);
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 512
#include <cstdio>

int main() {
    int n;
    scanf("%d", &n);
    if (n == 1) {
        printf("Hello World\n");
    } else {
        int a, b;
        scanf("%d%d", &a, &b);
        printf("%d\n", a+b);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  cin >> n;
  cout << n*800 - n/15*200 << newl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define SI size()
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PF push_front
#define PB push_back
#define VE vector<int>
#define VP vector<PA>
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int MOD=1e9+7;
const int INF=1e9+7;
//
int main(){
  int A,N;
  cin>>N>>A;
  N%=500;
  if(N<=A){
    Yes(1);
  }else{
    Yes(0);
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
int main() {
  string a,b,c; cin>>a>>b>>c;
  if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
  
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>

int top, S[200];

void init_stack()
{
	top = -1;
}

void push(int v)
{
	S[++top] = v;
}

int pop()
{
	return S[top--];
}

int do_op(int a, int b, char op)
{
	int r = 0;
	
	switch (op) {
	case '+':
		r = a + b;
		break;
	case '-':
		r = a - b;
		break;
	case '*':
		r = a * b;
		break;
	}
	
	return r;
}

int main(int argc, char *argv[]) 
{
	char a[200];
	int op1, op2;

	//init_stack();
	while (scanf("%s", a) != EOF) {
		if (isdigit(*a)) {
			push(atoi(a));
		} else {
			op2 = pop();
			op1 = pop();
			push(do_op(op1, op2, *a));
		} 
	}
	
	printf("%d\n", pop());
	
	return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
#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 fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, K;
    cin >> N >> K;
    ll ans = 0;
    rep(b, 1, N + 1)
    {
        // N = pb + r (0 <= r < b)
        ll p = N / b;
        ll r = N % b;
        ans += p * max(0LL, (ll)b - K);
        ans += max(0LL, r - K + 1);
    }
    if (K == 0) ans -= N;
    cout << ans << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
 
int main(void){
 
int n,i;
 
scanf("%d",&n);
 
char s[n];
 
scanf("%s",&s);
 
if(n%2==1){
printf("No");
}else{
for(i=0;i<n/2;i++){
if(s[i]!=s[n/2+i]){break;}
}
 
if(i==n/2){printf("Yes");}
else{printf("No");}
 
}
 
return 0;
}

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

int main()
{
    int $=1;
    //cin>>$;
    while($--)
    {
       string s;
       cin>>s;
       if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout<<"Yes"<<endl;
       else cout<<"No"<<endl;
    }
}


/*
8888888888888888888888888888
    Md. Masud Mazumder
    University of Chittagong
    Department of CSE
8888888888888888888888888888
*/


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
    	String w = ns();
    	int[] cnt = new int[26];

    	for (int i=0; i<w.length(); i++) {
    		cnt[w.charAt(i) - 'a']++;
    	}

    	boolean flg = true;

    	for (int i=0; i<26; i++) {
    		if (cnt[i] % 2 != 0) {
    			flg = false;
    			break;
    		}
    	}

    	if (flg) {
    		out.println("Yes");
    	} else {
    		out.println("No");
    	}
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}


Measured memory_bytes: 8020
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

int binarySearch(alias pred, T)(in T[] arr, bool isLower = true)
{ 
	int ok, ng;
	if (isLower) { ok = cast(int)arr.length; ng = -1; }
	else		 { ok = -1; ng = cast(int)arr.length; }
	while (abs(ok-ng) > 1)
	{
		auto mid = (ok+ng) / 2;
		if (unaryFun!pred(arr[mid]))
			ok = mid;
		else ng = mid;
	}
	return ok;
}

void main()
{
	auto N = RD;
	auto L = RDA;
	L.sort!"a > b"();
	long ans;
	foreach (i; 0..N-2)
	{
		foreach (j; i+1..N-1)
		{
			auto remain = L[i] - L[j];
			auto pos = L[j+1..N].binarySearch!((long a) => remain - a >= 0)();
			ans += pos;
		}
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 380
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

class ESequenceDecomposing {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    in>>N;
	    multiset<int> S;
	    for(int i=0;i<N;i++){
	        int a;
	        in>>a;
	        auto itr = S.lower_bound(a);
	        if(itr==S.begin()) S.emplace(a);
	        else{
	            itr--;
	            S.erase(itr);
	            S.emplace(a);
	        }
	    }
	    out<<S.size()<<endl;
	}
};


int main() {
	ESequenceDecomposing solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int main(){
    int N, X, m_min, Num;
    int m[1000];

    cin >> N >> X;
    for(int i = 0; i < N; i++){
        cin >> m[i];
        X -= m[i];
    }

    m_min = m[0];

    for(int i = 0; i < N; i++){
        if(m_min > m[i])
            m_min = m[i];
    }

    Num = N + X / m_min;

    cout << Num;

    return 0;
}




Measured memory_bytes: 256
long i;main(n,k){for(scanf("%d%d",&n,&k);i<n;i++)k+k-1>n?i=n,puts("-1"):printf("%d %d %d\n",(n+1)*i/2%n+k,(n+(n+1)*i)/2%n+n+k,k+n+n+i);}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main{	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int num = 0;
		for(int i=0;i<s.length();i++){
			try{
				num+=Integer.parseInt(s.substring(i,i+1));
			}catch(Exception e){}
			num%=9;
		}
		if(num==0)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}
}

Measured memory_bytes: 49832
#include <iostream>
#include <iomanip>
#include<cstdlib>
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
void call(int n);
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	
	int ab[3];
	ab[0]=abs(a-b);
	ab[1]=abs(b-c);
	ab[2]=abs(a-c);
	int max=0;
	int u;
	for(int i=0;i<3;i++){
		
		if(max<ab[i]){
			max=ab[i];
			u=i;
		}
	}
	ab[u]=0;
	int ans;
	for(int i=0;i<3;i++){
		ans=ans+ab[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <functional>
#include <memory>
#include <utility>

template<typename T, typename Compare = ::std::less<T>>
class skew_heap {
    using value_type = T;
    using const_reference = const value_type &;
    using size_type = ::std::size_t;
    using value_compare = Compare;

    class node_type {
    public:
        ::std::unique_ptr<node_type> left, right;
        value_type value;

        explicit constexpr node_type(const value_type &_value = T()) : value(_value), left(nullptr), right(nullptr) {}
    };

    using pointer_type = ::std::unique_ptr<node_type>;

    pointer_type root;

    value_compare comp;

    size_type _size;

    pointer_type meld(pointer_type a, pointer_type b) {
        if (!a)return b;
        if (!b)return a;
        if (comp(a->value, b->value))a.swap(b);
        a->right = meld(::std::move(a->right), ::std::move(b));
        a->left.swap(a->right);
        return a;
    }

public:
    constexpr skew_heap() : root(nullptr), comp(), _size(1) {}

    explicit constexpr skew_heap(const value_compare &_comp) : root(nullptr), comp(_comp), _size(1) {}

    constexpr bool empty() const noexcept { return !_size; }

    constexpr size_type size() const noexcept { return _size; }

    constexpr const_reference top() const noexcept {
        return root->value;
    }

    void push(const_reference val) {
        root = meld(::std::move(root), ::std::make_unique<node_type>(val));
        ++_size;
    }

    void push(value_type &&val) {
        root = meld(::std::move(root), ::std::make_unique<node_type>(::std::move(val)));
        ++_size;
    }

    template<class... Args>
    void emplace(Args &&... args) {
        root = meld(::std::move(root), ::std::make_unique<node_type>(::std::forward<Args>(args)...));
        ++_size;
    }

    void pop() {
        root = meld(::std::move(root->right), ::std::move(root->left));
        --_size;
    }

    void meld(skew_heap &x) {
        _size += x.size();
        x._size = 0;
        root = meld(::std::move(root), ::std::move(x.root));
    }
};

#include <bits/stdc++.h>

int main(){
    using namespace std;
    size_t Q;
    cin >> Q;
    skew_heap<long, less<>> pq1;
    skew_heap<long, greater<>> pq2;
    long C{0};
    for(unsigned long i = 0, a, b, c; i < Q; ++i)if(cin >> c, c == 1) {
        cin >> a >> b;
        pq1.push(a);
        auto t = pq1.top();
        pq1.pop();
        C += b - a + 2 * t;
        pq2.push(t);
        if (pq1.size() < pq2.size()) {
            auto k = pq2.top();
            pq2.pop();
            C -= 2 * k;
            pq1.push(k);
        }
    }else cout << pq1.top() << " " << C + (pq1.size() != pq2.size()) * pq1.top() << endl;
    return 0;
}

Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,u,v,ans=0;
    cin>>n;
    rep1(i,n-1) cin>>u>>v,ans+=i*(n-i+1)-min(u,v)*(n-max(u,v)+1);
    cout<<ans+n<<"\n";
}

Measured memory_bytes: 3644
import collections
def main():

    N = int(input())
    A = list(map(int, input().split()))
    d = collections.defaultdict(int)
    ans = 0
    for j in range(N):
        if A[j] - (j+1) in d:
            ans += d[A[j]-(j+1)]
        d[-(j+1)-A[j]] += 1
    return ans


if __name__ == '__main__':
    print(main())


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

int main() {
  double a,b;
  double c=0;
  string d;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b>>d;
    if(d=="JPY"){
      c+=b;
    }
    else{
      c+=b*380000.0;
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
def num():
    return int(input())

def nums():
    return list(map(int,input().split(" ")))

#A
"""
date = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(date[input()])
"""
#B
import string as s
N,S = num(),input()
letters = s.ascii_uppercase
ans = ""
for i in S:
    ans += letters[(letters.index(i)+N)%len(letters)]
print(ans)

Measured memory_bytes: 3768
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] grid = new int[H][W];
        for (int i = 0; i < H; i++) {
            String s = sc.next();
            for (int j = 0; j < W; j++) {
                if (s.charAt(j) == '#') {
                    grid[i][j] = -1;
                }
            }
        }

        long[][] dp = new long[H][W];
        dp[0][0] = 1;
        for (int r = 0; r < H; r++) {
            for (int c = 0; c < W; c++) {
                if (grid[r][c] == -1) continue;
                if (r > 0) {
                    dp[r][c] = addSelf(dp[r][c], dp[r - 1][c]);
                }
                if (c > 0) {
                    dp[r][c] = addSelf(dp[r][c], dp[r][c - 1]);
                }
            }
        }
        out.println(dp[H - 1][W - 1]);
        out.close();
    }

    static long mod = (long) 1e9 + 7;

    static long addSelf(long x, long val) {
        x += val;
        if (x >= mod) {
            x -= mod;
        }
        return x;
    }
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

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

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

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

Measured memory_bytes: 40724
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main () {
	int N;
	vector<int> v;
	cin >> N;
	for (int i=0; i<N; i++) {
		int tmp;
		cin >> tmp;
		v.push_back (tmp);
	}
	sort (v.begin (), v.end ());
	double sum = v.at(0);
	for (int i=1; i<N; i++)
		sum = (sum + v.at(i)) / 2.0;
	printf ("%lf\n", sum);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
int t[2005], u[200];
ll mod = 1000000007;

ll i, a, b, c, k, n, m, z = 0;
char s[100005];
int main() {
	cin >> n ;
	b = 0;
	c = 10000000000;
	rep(i, n) {
		cin >> a;
		if (a < 0) {
			b++; a = -a;
		}
		c = min(a, c);
		z += a;
	}
	if (b % 2 == 1)cout <<( z - 2*c);
	else cout << z;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    ll dist = abs(a - b);
    if (dist > (v - w)*t){
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void){
    // Your code here!
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m ,&f ,&r);
        if(m==-1&&f==-1&&r==-1) break;
        
        if(f==-1||m==-1){
            printf("F\n");
        }else if(m+f>=80){
            printf("A\n");
        }else if(m+f>=65){
            printf("B\n");
        }else if(m+f>=50){
            printf("C\n");
        }else if(m+f>=30){
            if(r>=50){
                printf("C\n");
            }else {
                printf("D\n");
            }
        }else{
            printf("F\n");
        }
    }
}



Measured memory_bytes: 2064
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	l := make([]int, n)
	for i := range l {
		fmt.Scan(&l[i])
	}

	for i, v := range l {
		left := 0
		for j := 0; j < i; j++ {
			left += l[j]
		}
		right := 0
		for j := i + 1; j < n; j++ {
			right += l[j]
		}
		if v >= left+right {
			fmt.Println("No")
			break
		}
		if i == n-1 {
			fmt.Println("Yes")
		}
	}
}


Measured memory_bytes: 512
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int t;
    cin>>t;
    if(t>=30)
    cout<<"Yes";
    else
    cout<<"No";
}

Measured memory_bytes: 3648