akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace P0023_CirclesIntersection
{
    class Program
    {
        static void Main(string[] args)
        {
            var lines = new List<List<string>>();
            var n = int.Parse(Console.ReadLine());
            for (int i = 1; i <= n; i++)
            {
                var sp = Console.ReadLine().Split(' ').ToList<string>();
                lines.Add(sp);
            }

            foreach (var line in lines)
            {
                var xa = decimal.Parse(line[0]);
                var ya = decimal.Parse(line[1]);
                var ra = decimal.Parse(line[2]);
                var xb = decimal.Parse(line[3]);
                var yb = decimal.Parse(line[4]);
                var rb = decimal.Parse(line[5]);

                var xaL = xa - ra;
                var xaR = xa + ra;

                var yaB = ya - ra;
                var yaU = ya + ra;

                var xbL = xb - rb;
                var xbR = xb + rb;

                var ybB = yb - rb;
                var ybU = yb + rb;

                var d2 = ((xa - xb) * (xa - xb)) + ((ya - yb) * (ya - yb));
                
                if (xaL < xbL && xaR > xbR && yaB < ybB && yaU > ybU) 
                {
                    Console.WriteLine("2");
                }
                else if (xaL > xbL && xaR < xbR && yaB > ybB && yaU < ybU)
                {
                    Console.WriteLine("-2");
                }
                else if (d2 <= (ra + rb) * (ra + rb))
                {
                    Console.WriteLine("1");
                }
                else 
                {
                    Console.WriteLine("0");
                }

            }

        }
    }
}

Measured memory_bytes: 6120
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 123456789;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

int main() {
	ll n,k;
	scanf("%lld%lld",&n,&k);
	ll ans=n*n;
	if(k==0)return !printf("%lld",ans);
	for(ll b=1;b<=n;b++)
	{
		ll t=n/b;
		ans-=t*min(b,k);
		ll m=n-b*t;
		if(m>=k)ans-=k-1;
		else ans-=m;
	}
	printf("%lld",ans);
}

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

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

    ll h, w, m;
    cin >> h >> w >> m;

    vector<ll> a(m), b(m);
    vector<ll> hcnt(h+10, 0), wcnt(w+10, 0);
    ll hmx = 0;
    ll wmx = 0;
    map<pair<int, int>, int> grid;
    rep(i, m){
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];
        grid[{a[i], b[i]}] = 1;

        ++hcnt[a[i]];
        ++wcnt[b[i]];
        if(hcnt[a[i]] > hmx){
            hmx = hcnt[a[i]];
        }
        if(wcnt[b[i]] > wmx){
            wmx = wcnt[b[i]];
        }
    }

    vector<int> hmxs, wmxs;
    rep(i, h){
        if(hcnt[i] == hmx) hmxs.push_back(i);
    }
    rep(i, w){
        if(wcnt[i] == wmx) wmxs.push_back(i);
    }

    int hh = hmxs[0];
    int ww = wmxs[0];
    bool found = false;
    for(auto hi: hmxs) for(auto wj: wmxs){
        if(grid[{hi, wj}] == 0){
            hh = hi;
            ww = wj;
            found = true;
            break;
        }
    }

    if(found) cout << hcnt[hh] + wcnt[ww] << endl;
    else cout << hcnt[hh] + wcnt[ww] -1 << endl;
    
    return 0;
}

Measured memory_bytes: 52500
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    
    ll a, b;
    cin >> a >> b;
    cout << b + b - a << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

vi g[N];
bool vis[N];
int cur = 0;

void dfs(int v) {
	vis[v] = 1;
	cur++;
	for(auto it : g[v]) {
		if(!vis[it]) {
			dfs(it);
		}
	}
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}
	int ans = 0;
	for(int i = 1; i <= n; i++) {
		if(!vis[i]) {
			cur = 0;
			dfs(i);
			ans = max(ans, cur);
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 21008
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i=0;i<n;i++) cin >> l[i];
    sort(l.begin(),l.end());
    int s=0;
    for (int i=0;i<n-1;i++) s+=l[i];
    if (s>l[n-1]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());

        int result = t / a * b;

        System.out.println(result);
    }
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
// #define P(x) cout << (x) << "\n"

// #define MOD 1000000007 // 1e9+7
// #define PI acos(-1.0)
// #define ll long long int // 10^18
// #define INF 1000000001 // 1e9+1

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

int n,m,a,b;
int main(){
  // std::ios::sync_with_stdio(false);
  // std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());
  bool p[8][8];
  REP(i,8)REP(j,8)p[i][j]=false;
  cin>>n>>m;
  for(int i=0; i<m; i++) {cin>>a>>b; a--; b--; p[a][b]=true; p[b][a]=true;}
  int G[8]={0,1,2,3,4,5,6,7};
  int cnt=0;
  do {
    if(G[0]!=0) continue;
    bool OK=true;
    for(int i=1; i<n; i++) {
      if(p[G[i-1]][G[i]]==false) OK=false;
    }
    if(OK==true) cnt++;
  } while(next_permutation(G,G+n));
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int n,a,b,c,d,e,g;
cin >> n >> a >> b >> c >> d;
if(n%a==0)e=n/a*b;
if(n%a!=0)e=(n/a+1)*b;
if(n%c==0)g=n/c*d;
if(n%c!=0)g=(n/c+1)*d;
if(e>=g)cout<<g<<endl;
if(e<g)cout<<e<<endl;
}


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {
	static String s = "";

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int ans = 0;

		int M1 = sc.nextInt();
		int D1 = sc.nextInt();

		int M2 = sc.nextInt();
		int D2 = sc.nextInt();

		if(M1 != M2)
			ans = 1;

		System.out.println(ans);

	}

}

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

int n;
int t[365][4][4];
map<int, int> memo;

int dfs(int day, int x, int y, int lu, int ru, int lb, int rb)
{
	int id = day;
	id = id * 10 + x;	id = id * 10 + y;	id = id * 10 + lu;
	id = id * 10 + ru;	id = id * 10 + lb;	id = id * 10 + rb;

	if (memo.find(id) != memo.end()) return memo[id];

	if(day == n) return (memo[id] = 1);

	rep(i, 0, 2) rep(j, 0, 2)
	{
		int xx = x + i;
		int yy = y + j;

		if (t[day][yy][xx] == 1) return (memo[id] = 0);
	}

	if (lu == 7) return (memo[id] = 0);
	if (ru == 7) return (memo[id] = 0);
	if (lb == 7) return (memo[id] = 0);
	if (rb == 7) return (memo[id] = 0);

	rep(xx, 0, 3) rep(yy, 0, 3)
	{
		if (x != xx && y != yy) continue;

		int ret;
		if (xx == 0 && yy == 0)
			ret = dfs(day + 1, xx, yy, 0, ru + 1, lb + 1, rb + 1);
		else if(xx == 0 && yy == 2)
			ret = dfs(day + 1, xx, yy, lu + 1, ru + 1, 0, rb + 1);
		else if(xx == 2 && yy == 0)
			ret = dfs(day + 1, xx, yy, lu + 1, 0, lb + 1, rb + 1);
		else if(xx == 2 && yy == 2)
			ret = dfs(day + 1, xx, yy, lu + 1, ru + 1, lb + 1, 0);
		else
			ret = dfs(day + 1, xx, yy, lu + 1, ru + 1, lb + 1, rb + 1);

		if(ret) return (memo[id] = 1);
	}

	return (memo[id] = 0);
}

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

	while (1)
	{
		cin >> n;
		if (n == 0) return 0;

		memo.clear();
		rep(i, 0, n) rep(j, 0, 4) rep(k, 0, 4) cin >> t[i][j][k];

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

Measured memory_bytes: 9268
college = Array.new(4).map { Array.new(3).map { ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } }

input = []

gets.to_i.times{ input << gets.split(' ').map(&:to_i) }

input.each do |e|
  b, f, r, v = e
  college[b - 1][f - 1][r] += v
end

college.each_with_index do |ary, i|
  puts ary.map{ |e| e.join(' ') }.join("\n")
  break if college.size - 1 == i
  puts '#' * 20
end

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

unsigned GetDigit(ull num) {
    return log10(num);
}

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

Measured memory_bytes: 3652
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
//	入力値
	static Scanner scInputData = new Scanner(System.in);
//	配列
	static ArrayList<Integer> arrA = new ArrayList<Integer>();
	
	public static void main(String[] args) {
		
//		必要なパラメータを用意する処理
//		個数情報を扱う変数
		int iNumVar = 0;
		
//		配列を取得する処理
		getArr();
//		クエリの回数を取得する処理
		iNumVar = getQueryNum();
		for(int iQueryNum=1; iQueryNum <= iNumVar; iQueryNum++) {
//			クエリを実行する処理
			doQuery();
		}

	}
	

	private static void doQuery() {
//		配列の範囲(b/e)
		int start = scInputData.nextInt();
		int end = scInputData.nextInt();
//		対象の値(k)
		int bingoNum = scInputData.nextInt();
//		対象の合計値
		int iTotal = 0;
		for(int iFactorNum=start; iFactorNum < end; iFactorNum++) {
			if(arrA.get(iFactorNum).intValue() == bingoNum)
				iTotal++;
		}
		 System.out.println(iTotal);
		
	}


	private static int getQueryNum() {
//		クエリの数
		return scInputData.nextInt();
		
	}


	private static void getArr() {
//		 配列の要素数
		int iArrNum = 0;
		iArrNum = scInputData.nextInt();
		while(arrA.size() < iArrNum) {			// !!!!!
			arrA.add(scInputData.nextInt());
		}
	}

}



Measured memory_bytes: 35920
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    int sum;
    rep(i,N){
    	if(i==0) sum = A[i];
    	else sum ^= A[i];
    }

    vector<ll> Ans;
    rep(i,N){
    	int ans = sum^A[i];
    	Ans.pb(ans);
    }

    rep(i,N) cout << Ans[i] << " ";
    cout << endl;

}

Measured memory_bytes: 6748
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]

a, b, c, k = map(int, input().split())
score = 0

if a <= k:
    score += a
    k -= a
else:
    score += k
    k = 0

if b < k:
    k -= b
    score -= k

print(score)


Measured memory_bytes: 9172
#include<iostream>
#include <cstdlib>
#include<list>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<stack>
using namespace std;
int main() {
	long long n, k, a[1000001] = { 0 }; cin >> n >> k; k--;
	for (int i = 0; i < n; i++)
	{
		int b, c;
		cin >> b >> c;
		a[b-1] += c;
	}int i=0; 
	while(1)
	{		if (k - a[i]>=0) {
			k -= a[i];
		}
		else {
			cout << i+1; break;
		}i++;
	}
return 0;
}


Measured memory_bytes: 8064
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<bits/stdc++.h>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define debug(x) cout <<#x<<": "<<x<<endl
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=5e6+20;
const int mod=1e9+7;
inline ll read() {
    char c=getchar();ll x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}
inline void out(ll x) {   
    if(x>9) out(x/10);   
    putchar(x%10+'0'); 
}

int main(){
    int x=read();
    if(x>=30)puts("Yes");
    else puts("No");
}
/*
 */

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <iostream>
#include <string>

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  u32 N = 0;
  cin >> N;

  vector<u32> a(N, 0);

  REP(i, N - 1) {
    u32 ai;
    cin >> ai;
    a[ai - 1]++;
  }

  for (auto &ai : a) {
    cout << ai << endl;
  }

  return 0;
}


Measured memory_bytes: 3944
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int h, w;
	cin >> h >> w;
	char a[h][w];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin >> a[i][j];
		}
	}
	bool black_r[h], black_c[w];
	for(int i=0; i<h; i++) black_r[i]=false;
	for(int i=0; i<w; i++) black_c[i]=false;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(a[i][j]=='#') black_r[i]=true;
		}
	}
	for(int j=0; j<w; j++){
		for(int i=0; i<h; i++){
			if(a[i][j]=='#') black_c[j]=true;
		}
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(black_r[i]&&black_c[j]){
				cout << a[i][j];
			}
		}
		if(black_r[i]) cout << endl;
	}
	return 0;
}

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

int main(){
    int N;
    std::cin >> N;
    std::vector< int > X(N);
    std::vector< int > Y(N);
    
    long long angle1 = 0;
    long long angle2 = 0;
    long long angle3 = 0;
    long long angle4 = 0;
    
    for(int i=0; i<N; i++){
        std::cin >> X[i] >> Y[i];
        angle1 = std::max(angle1, (long long)(1e9 - X[i] + 1e9 - Y[i]));
        angle2 = std::max(angle2, (long long)(X[i] + 1e9 - Y[i]));
        angle3 = std::max(angle3, (long long)(1e9 - X[i] + Y[i]));
        angle4 = std::max(angle4, (long long)(X[i] + Y[i]));
    }
    
    long long angle14 = std::abs(angle4 + angle1 - 2e9);
    long long angle23 = std::abs(angle3 + angle2 - 2e9);
    
    if(angle14 > angle23){
        std::cout << angle14 << std::endl;
    }else{
        std::cout << angle23 << std::endl;
    }
        
    //std::cout << angle1 << " " << angle2 << " " << angle3 << " " << angle4 << std::endl;
    //std::cout << angle14 << " " << angle23 << std::endl;
    
    return 0;
}



Measured memory_bytes: 4836
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <math.h>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

ll n;
ll dp[102][5][5][5];

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

    cin >> n;

    dp[0][3][3][3] = 1;
    //0 means A, 1 means G, 2 means C, 3 means T;

    for(int i = 0; i < n; i++){
        for(int left = 0; left < 4; left++){
            for(int mid = 0; mid < 4; mid++){
                for(int right = 0; right < 4; right++){
                    for(int now = 0; now < 4; now++){
                        if(mid == 0  && right == 1 && now == 2) continue;
                        if(mid == 1  && right == 0 && now == 2) continue;
                        if(mid == 0  && right == 2 && now == 1) continue;
                        if(left == 0 && right == 1 && now == 2) continue;
                        if(left == 0 && mid   == 1 && now == 2) continue;
                        
                        (dp[i+1][now][right][mid] += dp[i][right][mid][left]) %= mod;

                    }
                }
            }
        }
    }

    ll ans = 0;
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 4; j++){
            for(int k = 0; k < 4; k++){
                ans += dp[n][i][j][k];
            }
        }
    }

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


Measured memory_bytes: 384
def rev_f(string , i):
    if i[2] == '2':
        string = string + i[4]

    if i[2] == '1':
        string = i[4] + string
    return string



def rev_s(string , i):
    if i[2] == '1':
        string = string + i[4]

    if i[2] == '2':
        string = i[4] + string
    return string



front = ''
back = ''
string = input()
num = int(input())
q_list = []
reverse_num = 0
reverse = True
reverese_s = False
for a in range(num):
    i = input()
    if i == '1':
        reverse_num  +=1 
        if reverese_s:
            reverese_s = False
        else:
            reverese_s = True
    else:
        if reverese_s == False:
            if i[2] == '2':
                back += i[4]
            else:
                front = i[4] + front
            
        else :
            if i[2] == '2':
                front = i[4] + front
            else:
                back += i[4]
        
if reverse_num %2 == 0:
    reverse = False
    
string = front + string + back
if reverse == True:
    string = string[::-1]
    
print(string)


Measured memory_bytes: 4412
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
void __dump(int x){cerr << x;}
void __dump(long long x){cerr << x;}
void __dump(long double x){cerr << fixed << setprecision(3) << x;}
void __dump(char x){cerr << '\'' << x << '\'';}
void __dump(const string &x){cerr << '"' << x << '"';}
void __dump(const char *x){cerr << '"' << x << '"';}
void __dump(bool x){cerr << (x ? "true" : "false");}
void _dump(){cerr << "\n";}
template <typename T, typename U> void __dump(const pair<T, U> &x){cerr << '{'; __dump(x.first); cerr << ','; __dump(x.second); cerr << '}';}
template <typename T, typename U, typename V> void __dump(const tuple<T, U, V> &x){cerr << '{'; __dump(get<0>(x)); cerr << ',';  __dump(get<1>(x)); cerr << ',';  __dump(get<2>(x)); cerr << '}';}
template <typename T> void __dump(const T& x){int f=0; cerr << '{'; for(auto&i:x) cerr << (f++ ? "," : ""), __dump(i); cerr << "}";}
template <typename T, typename ... U> void _dump(T t, U ... u){__dump(t); if(sizeof...(u)) cerr << ", "; _dump(u...);}
#define dump(x ...) cerr  <<  "|| "  <<  # x  <<  "  =  ", _dump(x) 
//#define int long long
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define size(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define ln '\n'
#define __ ' '
#define LL long long
#define LD long double
#define pii pair<int,int>
const LL INFLL = 1e18;
const int INF = 2e9;
const int NN = 2e5;
template<typename T> struct OrderedMultiset{
	tree<pair<T,int>, null_type, less<pair<T,int>>, rb_tree_tag, tree_order_statistics_node_update> _s;
	int id = 1;
	void insert(const T &x){ _s.insert({x, id}); ++id; }
	void erase(const T &x){ auto it=_s.upper_bound({x, -1}); if(it!=_s.end() && it->first==x) _s.erase(it); }
	int count(const T &x){ return _s.order_of_key({x, 1e9}) - _s.order_of_key({x, -1}); }
	int count(const T &l, const T &r){ return _s.order_of_key({r, 1e9}) - _s.order_of_key({l, -1}); }  // [l;r] inclusive
	T operator[](const int &ind){ assert(1 <= ind && ind <= size(_s)); return _s.find_by_order(ind-1)->first; } // 1-indexed
};
int n,k;
int arr[NN+3];
LL pref[NN+3];
OrderedMultiset<LL> ms;
LL ans;

int main(){ FAST
	cin >> n >> k;
	for(int i=1; i<=n; ++i) cin >> arr[i];

	for(int i=1; i<=n; ++i) arr[i]-=k;

	for(int i=1; i<=n; ++i) pref[i] = arr[i] + pref[i-1];

	ms.insert(0);
	for(int en=1; en<=n; ++en){
		ans += ms.count(-INFLL, pref[en]);
		ms.insert(pref[en]);
	}

	cout << ans << ln;
}

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

#define pout(n)  printf ("%d\n", n)
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)
const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
#define MAX_N (int)2e5+20
typedef long long ll;
using namespace std;

int a,b,c,d;
int main(){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    a = min(a,b);
    c = min(c,d);
    pout(a+c);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{ 
   string s, t;
   cin >> s >> t;

   sort (s.begin(), s.end());
   sort (t.begin(), t.end());
   reverse(t.begin(), t.end());

   if (s < t){
       cout << "Yes" << endl;
   }else{
       cout << "No" << endl;

   }
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
div = 10**9+7

s_dict = {}
for s in S:
    if s in s_dict:
        s_dict[s] += 1
    else:
        s_dict[s] = 2

ans = 1
for val in s_dict.values():
    ans *= val
print((ans-1)%div)


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

int main()
{
	int N;
	int cnt = 0;
	cin >> N;
	
	for ( int i = 0; i < N; i++ ) {
		int A;
		cin >> A;
		while ( A % 2 == 0 ) {
			A /= 2;
			cnt++;
		}
	}

	cout << cnt << endl;

	return ( 0 );
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
	char x[100];
	scanf("%s",&x);
	if (x[0]=='9')
	{
		printf("Yes\n");
	}else if (x[1]=='9')
	{
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}

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

    char tmp = s[0];
    int ans = 1;
    rep(i, n){
        if(s[i] != tmp){
            tmp = s[i];
            ans++;
        }
    }
    cout << ans;

    return 0;
}

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

int main() {
  int N,K,n=1;
  cin >> N >> K;
  
  for(int i;i < N;i++) {
    if(2*n >= n+K) {
      n += K;
    }
    else {
      n *=2;
    }
  }
  cout << n << endl;
}

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

int main(){
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    for(int i = 0;i < n;i++)cin >> a.at(i);
    for(int i = 0;i < n;i++){
        x += (1 + (d - 1) / (a.at(i)));
    }
    cout << x << endl;
}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;
const lli mod = 1000000007;
const lli e3 = 1 << 13;
const lli INF = 1ll << 62;

lli a,b;

int main(){
  cin >> a >> b;
  if(b%a) cout << b-a << endl;
  else cout << a+b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int a, b, c; cin >> a >> b >> c;
    int maxv = max(a, max(b,c));

    int goal = maxv*3;
    int sum = a+b+c;

    if((goal-sum)%2 == 0) cout << (goal-sum)/2 << endl;
    else cout << (goal+3-sum)/2 << endl;

    return 0;
}

Measured memory_bytes: 256
# ABC121B - Can you solve this?
n, m, c = list(map(int, input().rstrip().split()))
lst = [list(map(int, input().rstrip().split())) for _ in range(n + 1)]
count = 0

for i in range(1, n + 1):
    total = 0
    for j in range(m):
        total += lst[i][j] * lst[0][j]
    if total + c > 0:
        count += 1

print(count)

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

int main()
{   
    //データ定義
    string str;
    int alpha[26] = {};
    int i;
    
    //文字のカウント
    while(getline(cin, str)){
        for(i = 0; i < str.size(); i++){
            if(str[i] >= 'a' && str[i] <= 'z'){
                alpha[str[i] - 'a']++;
            }else if(str[i] >= 'A' && str[i] <= 'Z'){
                alpha[str[i] - 'A']++; 
            }
        }
    }
    //結果出力
    for(i = 0; i < 26; i++){
        cout << (char)('a' + i) << " : " << alpha[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

const ll INF = (1LL << 60);

class Dijkstra {
public:
  struct edge {
    ll v;
    pll dist;
  };

  struct state {
    ll v;
    pll cost;
    bool operator>(const state s) const { return cost > s.cost; }
  };

  ll N;
  vector< vector<edge> > E;

  Dijkstra(ll n): N(n), E(n) {}

  void add_directed_edge(ll u, ll v, pll d) {
    E[u].push_back((edge) { v, d });
  }

  vector<pll> shortest_path(ll S) {
    vector<pll> dp(E.size(), pll(INF, INF));
    priority_queue<state, vector<state>, greater<state>> q;
    q.push((state) { S, pll(0, 0) });
    while(!q.empty()) {
      ll v = q.top().v;
      pll cost = q.top().cost;
      q.pop();
      if(dp[v] <= cost) continue;
      dp[v] = cost;
      REP(i, 0, E[v].size()) {
        ll nv = E[v][i].v;
        pll ncost = pll(cost.first + E[v][i].dist.first, cost.second + E[v][i].dist.second);
        if(dp[nv] > ncost) q.push((state) { nv, ncost });
      }
    }
    return dp;
  }
};

int main(void) {
  ll N, Time;
  cin >> N >> Time;
  string A, B;
  cin >> A >> B;
  vector<vector<string>> S(N);
  vector<vector<ll>> T(N);
  REP(i, 0, N) {
    ll a; cin >> a;
    REP(j, 0, a) {
      string s; cin >> s;
      S[i].push_back(s);
    }
    REP(j, 0, a - 1) {
      ll t; cin >> t;
      T[i].push_back(t);
    }
  }

  vector<string> vec;
  vec.push_back(A);
  vec.push_back(B);
  REP(i, 0, N) REP(j, 0, S[i].size()) vec.push_back(S[i][j]);
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());

  vector<pair<ll, string>> idx;
  REP(i, 0, N) REP(j, 0, S[i].size()) idx.push_back(pair<ll, string>(i * 1000000000 + j, S[i][j]));
  REP(i, 0, vec.size()) idx.push_back(pair<ll, string>(-1, vec[i]));
  sort(idx.begin(), idx.end());

  Dijkstra dijk(idx.size());
  ll s = lower_bound(idx.begin(), idx.end(), pair<ll, string>(-1, A)) - idx.begin();
  ll g = lower_bound(idx.begin(), idx.end(), pair<ll, string>(-1, B)) - idx.begin();
  REP(i, 0, N) {
    REP(j, 0, S[i].size() - 1) {
      ll p = lower_bound(idx.begin(), idx.end(), pair<ll, string>(i * 1000000000 + j, S[i][j])) - idx.begin();
      ll q = lower_bound(idx.begin(), idx.end(), pair<ll, string>(i * 1000000000 + j + 1, S[i][j + 1])) - idx.begin();
      dijk.add_directed_edge(p, q, pll(T[i][j], 0));
      dijk.add_directed_edge(q, p, pll(T[i][j], 0));
    }
  }
  REP(i, 0, N) {
    REP(j, 0, S[i].size()) {
      ll p = lower_bound(idx.begin(), idx.end(), pair<ll, string>(i * 1000000000 + j, S[i][j])) - idx.begin();
      ll q = lower_bound(idx.begin(), idx.end(), pair<ll, string>(-1, S[i][j])) - idx.begin();
      if(q != g) {
        dijk.add_directed_edge(p, q, pll(Time, 1));
        dijk.add_directed_edge(q, p, pll(0, 0));
      } else {
        dijk.add_directed_edge(p, q, pll(0, 0));
        dijk.add_directed_edge(q, p, pll(0, 0));
      }
    }
  }

  pll ans = dijk.shortest_path(s)[g];
  if(ans == pll(INF, INF)) cout << -1 << endl;
  else cout << ans.first << " " << ans.second << endl;
}


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

int main(){
  int n;
  while(cin >> n,n != 0){
    int k[10000];
    int tmp = 0;
    int tmp1 = 0;
    for(int i = 0;i < n;i++) scanf("%d",&k[i]);

    for(int i = 0;i < n;i++){
      if(k[i] > 0) tmp++;
      if(k[i] == 1) tmp1++;
    }

    if(tmp - tmp1 <= 0){
      cout << "NA" << endl;
    }else{
      cout << tmp+1 << endl;
    }
  }
  return 0;
}






Measured memory_bytes: 3284
// フル参加…ですね……
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
using namespace std;
using lint = long long;
template<class T> using grid = vector<vector<T>>;
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; }
static const lint MOD = (lint)1e9+7;

int main()
{
    string S;
    cin >> S;
    if (S == "Sunny")
    {
        cout << "Cloudy" << endl;
        return 0;
    }
    if (S == "Cloudy")
    {
        cout << "Rainy" << endl;
        return 0;
    }
    if (S == "Rainy")
    {
        cout << "Sunny" << endl;
        return 0;
    }


    return 0;
}


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

// input
char b;


void input() {
    cin >> b;
}


int main() {
    input();
    map<char, char> m;
    m['A'] = 'T';
    m['T'] = 'A';
    m['C'] = 'G';
    m['G'] = 'C';
    char ans = m[b];
    cout << ans << endl;
}


Measured memory_bytes: 3568
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
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; }
// const ll INF = 1LL <<60;
// const int INF = 10000;

//最大公約数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

const int MAX = 1e6+1;
const int MOD = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];

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

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


//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}

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

//sieve(MAX);でベクトルIsPrimeに「MAXまでの数値の素数の真偽」を格納する。
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}
// ここから開始

int main(){
    int n;
    cin>>n;
    for(double i = 1; i <= n; i++){
        if(n==(int)(i*1.08)){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	ll n;
	cin>>n;
	if((n|11)==0)cout<<1<<endl;
	else if((n|11)==1)cout<<2<<endl;
	else if((n|11)==2)cout<<1<<endl;
	else{
		rep(i,100){
			if(n<(1ll<<i)){
				cout<<n+1<<endl;
				return 0;
			}
			if((n&1ll<<i)==0){
				cout<<(1ll<<i)<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N; cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A.at(i) >> B.at(i);
  ll tot = 0;
  for (ll i = N-1; i >= 0; i--) {
    ll x = (tot + A.at(i)) % B.at(i);
    if (x == 0) continue;
    tot += B.at(i) - x;
  }
  cout << tot << endl;
	  
  

  return 0;
}



Measured memory_bytes: 1024
/**Bismillahir Rahmanir Rahim.**/
/*gcd=--gcd(a,b);*/
/*double p =log(a);
    p=p-floor(p);
    int x=pow(10,p);    m s di
 int x =floor(log10(a)) + 1;  d co
 a=ceil(log2(n)) == floor(log2(n)); pow of 2*/

#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<string>
using namespace std;
#define nl endl
#define in cin
#define out cout
#define ll long long
ll x[1000000];
int main()
{
   ll a,b,c,d,e,i,j;
   in>>a;
   if(a>=400&&a<=599)cout<<8<<nl;
   if(a>=600&&a<=799)cout<<7<<nl;
   if(a>=800&&a<=999)cout<<6<<nl;
   if(a>=1000&&a<=1199)cout<<5<<nl;
   if(a>=1200&&a<=1399)cout<<4<<nl;
   if(a>=1400&&a<=1599)cout<<3<<nl;
   if(a>=1600&&a<=1799)cout<<2<<nl;
   if(a>=1800&&a<=1999)cout<<1<<nl;

}


Measured memory_bytes: 3604
N = int(input())
l = []
b = int(380000)
t = 0

for i in range (N):
  l.append(list(map(str, input().split())))
  
for j in range (N):
  
  if l[j][1] == "BTC":
    t += float(l[j][0])*b
    
  else:
    t += float(l[j][0])
    
print(t)

Measured memory_bytes: 3060
N, Y = gets.split.map(&:to_i)
# binding.pry
0.upto(N) do |x|
  0.upto(N - x) do |y|
    z = (Y - (10000 * x + 5000 * y)) / 1000
    # p "#{x},#{y},#{z}"
    if z >= 0 && x + y + z == N
      puts "#{x} #{y} #{z}"
      exit
    end
  end
end
puts "-1 -1 -1"

Measured memory_bytes: 3836
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[210][210];
int C[210];
int d[210][210];

bool dfs(int s,int c){
	C[s]=c;
	REP(i,N){
		if(A[s][i]==1){
			if(C[i]==c){
				return false;
			}
			else if(C[i]==0&&dfs(i,-c)==false){
				return false;
			}
		}
	}
	return true;
}

signed main(){
	cin>>N;
	REP(i,N){
		string s;
		cin>>s;
		REP(j,s.size()){
			A[i][j]=s[j]-'0';
			if(A[i][j]==0){
				d[i][j]=INF;
			}
			else{
				d[i][j]=1;
			}
		}
	}
	REP(i,N){
		d[i][i]=0;
	}
	REP(i,N){
		if(C[i]==0){
			if(dfs(i,1)==false){
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	REP(k,N){
		REP(i,N){
			REP(j,N){
				d[i][j]=min(d[i][j],d[i][k]+d[j][k]);
			}
		}
	}
	int ans=0;
	REP(i,N){
		REP(j,N){
			ans=max(ans,d[i][j]);
		}
	}
	ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int H, W, K, ans = 0, sum = 0;
char c[8][8];
vector<int> row(8, 0);
vector<int> col(8, 0);

int cnt = 0;
int main()
{
    cin >> H >> W >> K;

    rep(i, 0, H)
    {
        rep(j, 0, W)
        {
            cin >> c[i][j];
        }
    }

    //行だけで探す
    for (int maskR = 0; maskR < (1 << H); maskR++)
    {
        for (int maskC = 0; maskC < (1 << W); maskC++)
        {
            cnt = 0;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0 && c[i][j] == '#')
                    {
                        cnt++;
                    }
                }
            }
            if (cnt == K)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3532
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

int main(void){
    ll n;
    cin >> n;
    cout << (1000-(n % 1000))%1000 << endl;
    return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i=0;i<N;i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

string s;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>s;
    char tmp;
    bool ans = true;
    rep(i,s.size()){
        if(i!=0 && s[i]==tmp)ans = false;
        tmp = s[i];
    }
    if(ans){
        print("Good");
    }else{
        print("Bad");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
ll mod=1000000007;
int main(){
	int n,m;
	ll ans=0LL;
	cin >>n>>m;
	V fact(100020,1LL);
	rep(i,100002){
		if(i!=0){
			fact[i]=fact[i-1]*i%mod;
			clog<<fact[i]<<endl;
		}
	}
	switch(abs(n-m)){
		case 0:
		ans=fact[n]*fact[m]%mod*2LL%mod;
		break;
		case 1:
		ans=fact[n]*fact[m]%mod;
		break;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024