akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	string s;
	cin>>s;
	int a = 0;
	string t = "CF ";
	for(int i = 0; i < s.size();i++){
		if(s[i] == t[a]) a++;
	}
	cout<<(a==2?"Yes":"No")<<endl;
}

Measured memory_bytes: 764
#include <stdio.h>

typedef struct{
  int u, k, v[100];
} Adj;

int main()
{
  int n, i, j, l, cnt;
  Adj adj[100];
  
  scanf("%d",&n);
  for (i = 0; i < n; i++){
    scanf("%d%d",&adj[i].u,&adj[i].k);
    for (j = 0; j < adj[i].k; j++)
      scanf("%d",&adj[i].v[j]);
  }
  for (i = 0; i < n; i++){
    for (j = 0; j < n; j++){
      cnt = 0;
      for (l = 0; l < adj[i].k; l++)
	if (j+1 == adj[i].v[l]){
	  cnt++;
	  printf("1");
	}
      if (cnt == 0)
	printf("0");
      if (j != n-1)
	printf(" ");
    }
    printf("\n");
  }
    
  return 0;
}



Measured memory_bytes: 2076
import java.awt.Point;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int[] DX = { 1, 1, 0, -1, -1, 0 };
	static int[] DY = { 1, 0, -1, -1, 0, 1 };

	public static void main(String[] arg) {
		while (true) {
			int T = sc.nextInt();
			if (T == 0) break;
			int N = sc.nextInt();
			boolean[][] visited = new boolean[201][201];
			for (int i = 0; i < N; ++i) {
				int x = sc.nextInt() + 100;
				int y = sc.nextInt() + 100;
				visited[x][y] = true;
			}
			ArrayList<Point> ps = new ArrayList<Point>();
			int sx = sc.nextInt() + 100;
			int sy = sc.nextInt() + 100;
			visited[sx][sy] = true;
			ps.add(new Point(sx, sy));
			int ans = 1;
			for (int i = 0; i < T; ++i) {
				ArrayList<Point> next = new ArrayList<Point>();
				for (Point p : ps) {
					for (int j = 0; j < 6; ++j) {
						int nx = p.x + DX[j];
						int ny = p.y + DY[j];
						if (!visited[nx][ny]) {
							visited[nx][ny] = true;
							next.add(new Point(nx, ny));
						}
					}
				}
				ans += next.size();
				ps = next;
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 60920
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"
#define MOD 100000009

using namespace std;

typedef long long int lli;

struct job{
	lli a, b;
	bool operator<(job &other){
		if(b != other.b) return b < other.b;
		return a < other.a;
	};
};

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector <job> ar(n);
	for(int i=0; i<n; i++){
		int a, b;
		cin >> a >> b;
		ar[i] = {a, b};
	}	

	sort(ALL(ar));

	lli curtime = 0LL;
	for(int i=0 ;i<n; i++){
		curtime += ar[i].a;
		if(curtime > ar[i].b){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 3328
using System;


namespace ConsoleApplication22
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 3; )
            {
                String[] N = Console.ReadLine().Split(' ');
                int n = int.Parse(N[0]);
                int x = int.Parse(N[1]);
                int A = 0;
                if (n == 0 && x == 0)
                    break;

                for (int a = 1; a < n - 1; a++)
                {
                    for (int b = a + 1; b < n; b++)
                    {
                        for (int c = b + 1; c < n + 1; c++)
                        {
                            if (x == a + b + c)
                                A = A + 1;
                        }
                    }
                }
                Console.WriteLine(A);
            }
        }
    }
}

Measured memory_bytes: 9032
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int k = sc.nextInt();
		long[] score = new long[n];
		for (int i = 0; i < score.length; i++) {
			score[i] = sc.nextLong();
		}

		new Main().execute(n, k, score);
	}

	private void execute(int n, int k, long[] score) {
		for (int i = 0; i < n - k; i++) {
			long scorePrev = score[i];
			long scoreNext = score[i + k];
			if (scorePrev < scoreNext) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}

Measured memory_bytes: 52312
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
using ll = long long;
using ld = long double;
using Vi = V<int>;  using VVi = V<Vi>;
using Vl = V<ll>;   using VVl = V<Vl>;
using Vd = V<ld>;   using VVd = V<Vd>;
using Vb = V<bool>; using VVb = V<Vb>;
using Pi = P<int>;
using Pl = P<ll>;
using Pd = P<ld>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline ll cDiv(const ll x, const ll y) { return (x+y-1) / y; } // ceil(x/y)
inline int fLog2(const ll x) { assert(x > 0); return 63-__builtin_clzll(x); } // floor(log2(x))
inline int cLog2(const ll x) { assert(x > 0); return (x == 1) ? 0 : 64-__builtin_clzll(x-1); } // ceil(log2(x))
inline int popcount(const ll x) { return __builtin_popcountll(x); }
inline void fail() { cout << -1 << '\n'; exit(0); }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
// const int INF  = 1<<30;
// const ll INFll = 1ll<<60;
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
// const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n; cin >> n;

  cout << (n^1) << '\n';
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>

int main () {
    std::vector<int> a(5);
    std::vector<int> uq;

    int sum = 0;
    for (int i = 0; i < 5; i++)
    {
        std::cin >> a[i];
        if (a[i] % 10)
        {
            uq.push_back(a[i] % 10);
            a[i] += (10 - a[i] % 10);
            sum += a[i];
        }
        else
        {
            sum += a[i];
        }
    }
    if(!uq.size()) {
        uq.push_back(10);
    }

    int minuq = *std::min_element(uq.begin(), uq.end());
    sum += (-10 + minuq);

    std::cout << sum << "\n";
}

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

int main(){
    ll p,n,ans=1;
    cin>>p>>n;
    if(p==1)cout<<n<<endl;
    else{
        ll s = (ll)floor(sqrt(n));
        ll r = 0;

        // 2から平方根までの素因数を求める
        for (ll i = 2;i <= s;i++) {

            if ((n % i) == 0) {

                r = 0; // 指数カウンタクリア

                do {

                    r++; // 指数カウンタプラス

                    n = n / i;

                } while ((n % i) == 0);

                while(r>=p){
                    if(r>=p)ans*=i;
                    r-=p;
                }

            }

        }
        cout<<ans<<endl;
    }
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N,D;
    cin >> N >> D;

    cout << (N + (2*D+1)-1)/(2*D+1) << endl;
}


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

int main() {
  int N, A, otsuri;

  cin >> N;
  cin >> A;

  otsuri = N % 500;

  if (otsuri <= A) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

namespace AtCoder.Contest.B
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			var cin = new Scanner();

			int n = cin.NextInt();
            if (n % 2 == 1) Console.WriteLine("No");
            else
            {
				string s = cin.Next();
				bool ok = true;
                for (int i = 0; i < n / 2; i++)
                {
					if (s[i] != s[i + n / 2]) ok = false;
                }
                if (ok) Console.WriteLine("Yes");
                else Console.WriteLine("No");
            }

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 13140
N, Q = [int(i) for i in input().split()]
S = input()
lr = [[int(i) for i in input().split()] for _ in range(Q)]
ary = [0]*(N+1)
c = 0
f = bool(S[0] == "A")
for i in range(1, N):
    if S[i] == 'C' and f:
        c += 1
        f = False
    else:
        f = bool(S[i] == "A")
    ary[i] = c
for l, r in lr:
    print(ary[r-1]-ary[l-1])


Measured memory_bytes: 69208
a,b,c,k=input().split()
a=int(a)
b=int(b)
c=int(c)
k=int(k)

if a>=k:
    print(k)
else:
    if a+b>=k:
        print(a)
    else:
        s=k-a-b
        print(a-s)

Measured memory_bytes: 9184
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();
    let mut idx_a = 0;
    let mut idx_z = 0;
    for j in 0..s.len() {
        if s[j] == 'A' {
            idx_a = j;
            break;
        }
    }
    for i in (0..s.len()).rev() {
        if s[i] == 'Z' {
            idx_z = i;
            break;
        }
    }
    println!("{}", idx_z - idx_a + 1);
}


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

#define WHITE 0
#define GRAY -1
#define BLACK 1

int *u, *k, **v, *color, *d, *f;
int n, time;

void init() {
	int i, j;

	u = (int *)malloc(sizeof(int) * (n + 1));
	k = (int *)malloc(sizeof(int) * (n + 1));
	color = (int *)malloc(sizeof(int) * (n + 1));
	d = (int *)malloc(sizeof(int) * (n + 1));
	f = (int *)malloc(sizeof(int) * (n + 1));
	v = (int **)malloc(sizeof(int *) * (n + 1));

}

void input() {
	int i, j;

	scanf("%d", &n);
	init();

	for (i = 1; i <= n; i++) {
		scanf("%d%d", &u[i], &k[i]);
		v[i] = (int *)malloc(sizeof(int) * (k[i] + 1));
		for (j = 1; j <= k[i]; j++) {
			scanf("%d", &v[i][j]);
		}
	}
}

void DFSVisit(int u) {
	int i;

	color[u] = GRAY;
	d[u] = ++time;

	for (i = 1; i <= k[u]; i++) {
		if (color[v[u][i]] == WHITE) DFSVisit(v[u][i]);
	}
	color[u] = BLACK;
	f[u] = ++time;
}

void DFS() {
	int i;

	for (i = 1; i <= n; i++) {
		color[u[i]] = WHITE;
	}

	for (i = 1; i <= n; i++) {
		if (color[u[i]] == WHITE) DFSVisit(i);
	}
}

void output() {
	int i;

	for (i = 1; i <= n; i++) {
		printf("%d %d %d\n", u[i], d[i], f[i]);
		free(v[i]);
	}
	free(u);
	free(k);
	free(v);
	free(color);
	free(d);
}

main () {
	input();
	DFS();
	output();
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int T,D,L;
    while(cin >> T >> D >> L && T){
        vec<int> imos(T+2);
        for(int i=1;i<=T;i++){
            int x;
            cin >> x;
            if(x>=L){
                imos[i]++;
                imos[min(i+D,T+1)]--;
            }
        }
        int ans = 0;
        for(int i=1;i<T;i++){
            if(imos[i]>0) ans++;
            imos[i+1] += imos[i];
//            cerr << i << " " << imos[i] << "\n";
        }
        cout << ans << "\n";
    }
}



Measured memory_bytes: 3536
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		int a;
		cin >> a;
		if (i % 2 == 1) {
			if (a % 2 == 1)ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	ll i, j, k, l, m, n;
	cin>>n>>m;
	std::vector<ll> w(n+1),v(n+1);
	vector<vector<ll>> ar(n+1, vector<ll>(m+1,0));
	for(i=1; i<=n; i++)
	{
	    cin>>w[i]>>v[i];
	    vector<ll> vt(m+1,0);
	    for(j=1; j<=m; j++)
	    {
	        if(j < w[i]) ar[i][j] = ar[i-1][j];
	        else
	        {
	            ar[i][j] = max(ar[i-1][j],ar[i-1][j-w[i]] + v[i]);
	        }
	    }
	}
	cout<<ar[n][m]<<endl;
	return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b;
  cin>>a>>b;
  if(a<b){
    cout<<"a < b"<<"\n";
  }
  if(a>b){
    cout<<"a > b"<<"\n";
  }
  if(a==b){
    cout<<"a == b"<<"\n";
  }
  return(0);
}



Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
#include<bitset>

using namespace std;



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

if(s=="Sunny"){
  cout<<"Cloudy"<<endl;
}
else if(s=="Cloudy"){
  cout<<"Rainy"<<endl;
}
else
cout<< "Sunny"<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*
string s,s1,s2;
int a,b;
int main(){
	cin>>s>>s1;
	cin>>a>>b;
	cin>>s2;
	if(s2==s) a--;
	if(s2==s1) b--;
	cout<<a<<" "<<b<<endl;
	return 0;
}
*/
string s;
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++) cout<<"x";
	return 0;
}

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

int main()
{
    int N;
    cin >> N;

    pair<int, int> red[N];
    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        red[i] = make_pair(a, b);
    }
    sort(red, red + N);

    pair<int, int> blue[N];
    for (int i = 0; i < N; i++)
    {
        int c, d;
        cin >> c >> d;
        blue[i] = make_pair(c, d);
    }
    sort(blue, blue + N);

    bool has_pair[N] = {};
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int maximum = -1;
        int best_idx = -1;
        int idx = 0;
        while (red[idx].first < blue[i].first)
        {
            if (!has_pair[idx] && red[idx].second < blue[i].second && red[idx].second > maximum)
            {
                maximum = red[idx].second;
                best_idx = idx;
            }
            idx++;
        }
        if (best_idx >= 0)
        {
            has_pair[best_idx] = true;
            ans++;
        }
    }
    cout << ans << endl;
}


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

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using pli=pair<ll,int>;

#define fi first
#define se second
#define pb push_back
#define sz(x) int((x).size())
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define testcase int _;cin>>_;while(_--)
#define all(x) ((x).begin(),(x).end())


/*B-Distance*/
void Solve(){
	ll n,d;
	cin>>n>>d;
	int cnt=0;
	for(int i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		if(a*a+b*b<=d*d)
			cnt++;
	}
	cout<<cnt<<"\n";
}

int main(){
	fast
	//testcase
		Solve();
	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stdio.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
       int n;
    string s;
    cin >>n >> s;
    REP(i, s.length()){
        if(s[i]>90-n) printf("%c", s[i]+n-26);
        else printf("%c", s[i]+n);
    }
    return 0;
}

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

const ll MOD = 1e9+7;

int main(){
  
  ll n; cin >> n;
  string s; cin >> s;
  
  vector<bool> side(2*n);
  
  side[0] = false;
  
  ll t = 0,f = 1;
  
  for(ll i = 1; i < 2*n; i++){ 
    
    if( s[i-1] != s[i] ){ side[i] = side[i-1]; }
    else{ side[i] = !side[i-1];}
    
    if(side[i]){ t++;} else{ f++;}
  
  }
  
  if( s[0] == 'W' || s[2*n-1] == 'W' || t != f ){ 
    cout << 0 << endl; return 0;
  }
  
  ll l = 0,r = 0; ll ans = 1LL;
  
  for(ll i = 0; i < 2*n; i++){ 
    
    if(side[i]){
      ans *= max(l-r,0LL);
      ans %= MOD;
    }
  
    if(side[i]){r++;}
    else{l++;}
    
  }
  

  
  for(ll i = 1; i <= n; i++){
    
    ans *= i;
    
    ans %= MOD;
    
  }

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll int>
#define vs vector<string>
#define v vector<int>
#define mi map<int,int>
#define mc map<char,int>

//ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n,a,b,c;
	cin>>n>>a>>b;
	c=n*a;
	cout<<min(c,b) <<"\n";
}


Measured memory_bytes: 3636
A,B,C,K = map(int,input().split())
sum = 0
if K>0:
    if A>0:
        if A>K:
            sum = sum + K
        else:
            sum = sum + A
    K = K - A
if K > 0:
    if B>0:
        K = K - B
if K > 0:
    if C>0:
        sum = sum + K * (-1)
print(sum)

Measured memory_bytes: 9196
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N, M = map(int, input().split())
    d = defaultdict(list)

    py = []
    for i in range(M):
        p, y = map(int, input().split())
        py.append((p, y))
        d[p].append(y)

    d2 = {}
    for p in d.keys():
        d[p].sort()
        d3 = {}
        for i, y in enumerate(d[p], start=1):
            d3[y] = i
        d2[p] = d3

    for p, y in py:
        print(str(p).zfill(6) + str(d2[p][y]).zfill(6))


if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, w;
  cin >> n >> w;
  vector<long long> dp(w + 1);
  while (n--) {
    int x, y;
    cin >> x >> y;
    for (int i = w; i >= x; i--) {
      dp[i] = max(dp[i], dp[i - x] + y);
    }
  }
  cout << dp[w] << '\n';
  return 0;
}


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n;
	cin >> n;

	int c = n / 100;
	cout << "01"[c > 0 && c * 5 >= n - c*100];

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int A,B;
    cin>>A>>B;
    int ans=A+B;
    if(ans<A-B){
        ans=A-B;
    }
    if(ans<A*B){
        ans=A*B;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
S = input()
p = 0
while p == 0 and S != '':
  n = len(S)
  q = 0
  q5, q6, q7 = 0, 0, 0
  if n >= 5:
    if S[n-5:n] == 'dream' or S[n-5:n] == 'erase':
      q, q5 = 1, 1
  if n >= 6:
    if S[n-6:n] == 'eraser':
      q, q6 = 1, 1
  if n >= 7:
    if S[n-7:n] == 'dreamer':
      q, q7 = 1, 1
  if q5 == 1:
    S = S[:n-5]
  elif q6 == 1:
    S = S[:n-6]
  elif q7 == 1:
    S = S[:n-7]
  if q == 0:
    p += 1
    break
if p == 0:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.begin(), v.end(), greater<int>);
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};


// dijikstra
/* int V;
vector<edge> G[10];
int d[10];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d + V + 1, INF);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        REP(i, G[v].size()){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
*/

int main(){
    string s;
    cin >> s;
    int g = 0, p = 0;
    int ans = 0;
    REP(i, s.length()){
        if(s[i] == 'g'){
            if(p < g){
                ans++;
                p++;
            }else{
                g++;
            }
        }else{
            if(p < g){
                p++;
            }else{
                ans--;
                g++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    ll a,b,c;
    cin >> a >> b >> c;

    ll ans=0;
    if(a%2==0 || b%2==0 || c%2==0){
        cout << 0 << endl;
        return 0;
    }else{
        ans=min(a*b,min(a*c,c*b));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;

struct DSU {
    vector <int> par, sz, sze;
    int n;
    inline void init(int _n) {
        n = _n;
        par.resize(n + 1), sz.resize(n + 1, 1), sze.resize(n + 1);
    }
    int root(int x) {
        if(par[x] == 0)
            return x;
        return par[x] = root(par[x]);
    }
    inline void join(int x, int y) {
        x = root(x), y = root(y);
        if(x != y) {
            par[x] = y;
            sz[y] += sz[x];
            sze[y] += sze[x] + 1;
        }
    }
};

struct Edge {
    int x, y, z;
    bool operator <(const Edge &other) const {
        return z > other.z;
    }
};


int main() {
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n, h, w;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> h >> w;
    vector <Edge> edges(n);
    for(i = 0; i < n; i++) {
        cin >> edges[i].x >> edges[i].y >> edges[i].z;
        edges[i].y += h;
    }
    sort(edges.begin(), edges.end());
    DSU dsu; dsu.init(h + w);
    ll ans = 0;
    for(auto it : edges) {
        int x = dsu.root(it.x), y = dsu.root(it.y), z = it.z;
        if(x != y) {
            if(dsu.sze[x] + dsu.sze[y] + 1 <= dsu.sz[x] + dsu.sz[y]) {
                dsu.join(x, y);
                ans += z;
            }
        }
        else if(dsu.sze[x] < dsu.sz[x]) {
            dsu.sze[x]++;
            ans += z;
        }
    }
    cout << ans;

    return 0;
}




Measured memory_bytes: 3840
main = do 
  (x:y:xs) <- map read . words <$> getLine
  putStrLn . unwords . map show $ solve10000 0 x y


solve10000 m x y
  | x == 0 && y == 0 = [m,0,0]
  | x <= 0 || y <= 0 = [-1,-1,-1]
  | otherwise = 
      let mr = solve10000 (m+1) (x-1) (y-10000)
          sr = solve5000 0 x y
      in if head mr /= -1 then 
        mr 
      else if head sr /= -1 then
        (m:sr)
      else
        [-1,-1,-1]

solve5000 m x y
  | x == 0 && y == 0 = [m,0]
  | x <= 0 || y <= 0 = [-1,-1]
  | otherwise = if x * 1000 == y then [m,y `div` 1000] else solve5000 (m+1) (x-1) (y-5000)



Measured memory_bytes: 1148
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let mk: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let m = mk[0];
    let k = mk[1];

    if m==0 && k == 0 {
        println!("0 0");
    } else if m == 1 && k == 0 {
        println!("0 0 1 1");
    } else if k >= (1 << m)  || m <= 1 {
        println!("-1");
    } else {
        for i in 0..1 << m {
            if i != k {
                print!("{} ", i);
            }
        }
        print!("{} ", k);
        for i in (0..(1 << m)).rev() {
            if i != k {
                print!("{} ", i);
            }
        }
        println!("{}", k);
    }
}


Measured memory_bytes: 5884
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		String line2 = sc.nextLine();
		String line3 = sc.nextLine();
		sc.close();
		
		String[] values1 = line1.split(" ");
		String[] valuesX = line2.split(" ");
		String[] valuesY = line3.split(" ");
		
		int maxX = -100;
		for (String x : valuesX) {
			maxX = Math.max(maxX, Integer.parseInt(x));
		}
		int minY = 100;
		for (String y : valuesY) {
			minY = Math.min(minY, Integer.parseInt(y));
		}
		List<String> valuesZ = new ArrayList<>();
		for (int i=Integer.parseInt(values1[2])+1; i<=Integer.parseInt(values1[3]); i++) {
			valuesZ.add(String.valueOf(i));
		}

		String ans = "War";
		for (String value : valuesZ) {
			if (maxX < Integer.parseInt(value) && Integer.parseInt(value) <= minY) {
				ans = "No War";
				break;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "../../../debug_print.hpp"
#else
#define debug(...)
#endif
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; 0 <= i; i--)
#define for_(i, start, end) for (int i = start; i < end; i++)
#define rfor(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD53       = 998'244'353;
constexpr double PI       = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int N;
    scan(N);
    vector<int> v(N);
    scan(v);

    int mx  = v[0];
    int mn  = v[0];
    int ans = 1;
    for_(i, 1, N) {
        if ((v[i] < mx && v[i] < mn)) {
            ans++;
        }
        chmax(mx, v[i]);
        chmin(mn, v[i]);
    }
    print(ans);

    return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int x;
  cin >> x;
  int t = 0;
  for (int i = 1; i <= x; i++) {
    t += i;
    if (t >= x) {
      cout << i << endl;
      return 0;
    }
  }
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var A = int.Parse(ss[0]);
            var B = int.Parse(ss[1]);

            Console.WriteLine((A + B) % 24);
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std ;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define rep(i,a,b) for(lli i=a;i<b;i++)
#define repe(i,a,b) for(lli i=a;i<=b;i++)
#define all(v) v.begin(), v.end()
#define mod 1000000009
#define inf 100000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define endl '\n'
#define pie  acosl(-1.0);
#define setp(k, x) fixed << setprecision(k) << (x)
#define deb(x) cerr << #x << ": " << x << " " << endl;
#define debug(x) cout << "m here-" <<#x<<" ..."<<"\n";
#define printa(a,n) for(lli i=0;i<n;i++) cout<<a[i]<<" "; cout<<"\n";
#define printv(a) for(lli i=0;i<a.size();i++) cout<<a[i]<<" "; cout<<"\n";
bool sortcol( const vector<lli>& v1, const vector<lli>& v2 ) //sort on basis of column //use- sort(vect.begin(), vect.end(),sortcol);
{ return v1[1] < v2[1]; }//[] o based indexing in column
bool sortpair(const pair<lli, lli> &a, const pair<lli, lli> &b)
{return a.second < b.second;}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

	size_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

//////////////////////////////////////////////////////////////////////////////////////////////
void solve();

//////////////////////////////////////////////////////////////////////////////////////////////
//
// lli find_hash(string const& s){
// 	lli m = 10e8+7,p = 31,hash_value = 0,i,n,p_pow = 1;
//
// 	n = s.length();
//
// 	for(i = 0 ;i<n;i++){
// 		hash_value+= ((s[i]-'a'+1)*p_pow )%m;
// 		p_pow = p_pow *p;
// 	}
// 	return hash_value;
//
// }



int main ()
{
	// fastio
	lli  t;

	// cin>>t;
	// while(t--)
	{

		solve();

	}
}
///////////////////////////////////////////
void solve()
{
	lli n,i,d,a,b,c=0,j,k,x,y,check=0,m,len;
	cin>>n;
	string s[]={"AC","WA","TLE","RE"};
	unordered_map<string,lli> mpp;
	string t ;
	for(i=0;i<n;i++){
		cin>>t;
		mpp[t]++;
	}
	for(i = 0;i<4;i++){
		cout<<s[i]<<" x "<<mpp[s[i]]<<"\n";
	}




}


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#define INF 100000000
using namespace std;

int main(void){
    int N,M;
    cin>>N>>M;
    bool con1[N+1],conN[N+1];
    fill(con1,con1+N+1,false);
    fill(conN,conN+N+1,false);
    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
       if(a==1){con1[b]=true;}
       if(b==N){conN[a]=true;}
    }
    bool ans=false;
    for(int i=2;i<N;i++){
       if(con1[i]&&conN[i]){ans=true;}
    }
    if(ans)cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

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;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    string S; cin >> S;
    ll out=0;
    vector<int> r(N,0);
    vector<int> g(N,0);
    vector<int> b(N,0);
    int x=0,y=0,z=0;
    for(int i=0;i<N;i++){
        if(S[i]=='R'){
            x++;
        }
        if(S[i]=='G'){
            y++;
        }
        if(S[i]=='B'){
            z++;
        }
        r[i]=x;
        g[i]=y;
        b[i]=z;
    }
    //cerr << x << " " << y << " " << z << endl;
    ll sss=0;
    for(int j=1;j<N-1;j++){
        int i=j-1,k=j+1;
        sss=0;
        while(i>=0 && k<N){
            if(S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k]) sss++;
            i--;k++;
        }
        int s1,t1,s2,t2;
        if(S[j]=='R'){
            s1=g[j];
            s2=b[j];
            t1=y-g[j];
            t2=z-b[j];
        }
        if(S[j]=='G'){
            s1=r[j];
            s2=b[j];
            t1=x-r[j];
            t2=z-b[j];
        }
        if(S[j]=='B'){
            s1=r[j];
            s2=g[j];
            t1=x-r[j];
            t2=y-g[j];
        }
        //cerr << S[j] << "\t" << s1 << "\t" << s2 << "\t" << t1 << "\t" << t2 << "\t" << sss << "\t" << s1*t2+s1*t2-sss << endl;
        out += s1*t2+s2*t1-sss;
    }
    cout << out << endl;
    return 0;
}


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

using namespace std;

int main() {
	long long int n, c;
	cin >> n >> c;

	vector<long long int> x(n);
	vector<long long int> v(n);
	vector<long long int> x2(n);

	vector<long long int> vp(n, 0);
	vector<long long int> vq(n, 0);
	vector<long long int> vp2(n, 0);
	vector<long long int> vq2(n, 0);

	for (long long int i = 0; i < n; i++) {
		cin >> x[i] >> v[i];
		x2[i] = c - x[i];
	}

	long long int ans = 0;

	vp[0] = v[0];
	for (long long int i = 1; i < n; i++) {
		vp[i] = vp[i - 1] + v[i];
	}
	for (long long int i = 0; i < n; i++) {
		vp[i] -= x[i];
	}

	vq[n - 1] = v[n - 1];
	for (long long int i = n - 2; i >= 0; i--) {
		vq[i] = vq[i + 1] + v[i];
	}
	
	for (long long int i = 0; i < n; i++) {
		vq[i] -= x2[i];
	}

	vp2 = vp;
	vq2 = vq;
	
	vp2[0] = max(vp2[0], 0LL);
	for (long long int i = 1; i < n; i++) {
		vp2[i] = max(vp2[i - 1], vp2[i]);
	}

	vq2[n - 1] = max(vq2[n - 1], 0LL);
	for (long long int i = n - 2; i >= 0; i--) {
		vq2[i] = max(vq2[i + 1], vq2[i]);
	}
	/*
	for (long long int i = 0; i < n; i++) {
		cout << vp[i] << ' ';
	}
	cout << endl;

	for (long long int i = 0; i < n; i++) {
		cout << vp2[i] << ' ';
	}
	cout << endl;

	for (long long int i = 0; i < n; i++) {
		cout << vq[i] << ' ';
	}
	cout << endl;

	for (long long int i = 0; i < n; i++) {
		cout << vq2[i] << ' ';
	}
	cout << endl;
	*/

	ans = max(ans, vq2[0]);
	for (long long int i = 0; i < n; i++) {
		long long int ans2 = vp[i] - x[i];
		if (i + 1 < n) {
			ans2 += vq2[i + 1];
		}
		ans = max(ans, ans2);
	}

	ans = max(ans, vp2[n - 1]);
	for (long long int i = n - 1; i >= 0; i--) {
		long long int ans2 = vq[i] - x2[i];
		if (i - 1 >= 0) {
			ans2 += vp2[i - 1];
		}
		ans = max(ans, ans2);
	}

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

Measured memory_bytes: 5760
// test.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#include <iostream>
#include <algorithm>
#include <vector>




using namespace std;


int main()
{
	// 整数の入力
	string S;
	cin >> S ;
	
	if (S == "Sunny") cout << "Cloudy" << endl;
	if (S == "Cloudy") cout << "Rainy" << endl;
	if (S == "Rainy") cout << "Sunny" << endl;
	
	
	

	return 0;
}





// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int c = 0;
cin >> s;
for (int i = 0; i < s.size(); i++)
{
    if (s[i] == s[i-1] && s[i] == '0'){
        s[i] = '1';
    c++;
    }
    if (s[i] == s[i-1] && s[i] == '1'){
        s[i] = '0';
        c++;
    }
}
cout << c;
}

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

int main(){
	int n, pm, pe, pj, ave;
//	vector<int> ave;
	while(cin >> n, n){
		for(int i = 0; i < n; i++){
			cin >> pm >> pe >> pj;
			ave = (pm + pe + pj) / 3;
			if(pm == 100 || pe == 100 || pj == 100) cout << "A" << endl;
			else if((pm + pe)/2 >= 90) cout << "A" << endl;
			else if(ave >= 80) cout << "A" << endl;
			else if(ave >= 70) cout << "B" << endl;
			else if(ave >= 50 && (pm >= 80 || pe >= 80)) cout << "B" << endl;
			else cout << "C" << endl;
		 }
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N;
    cin >> N;

    auto graph = make_v<int>(N + 1, N + 1);
    int M = N * (N - 1) / 2;
    fill_v(graph, 1);
    rep2(i, 1, N + 1)
    {
        graph[i][i] = false;
    }
    if (N % 2 == 0)
        rep2(i, 1, N / 2 + 1)
        {
            graph[i][N + 1 - i] = false;
            M--;
        }
    else
    {
        rep2(i, 1, (N + 1) / 2)
        {
            graph[i][N - i] = false;
            M--;
        }
    }
    cout << M << '\n';
    rep2(i, 1, N + 1)
    {
        rep2(j, i, N + 1)
        {
            if (graph[i][j])
                cout << i << " " << j << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 384
#create date: 2020-04-19 21:00

import sys
stdin = sys.stdin
import math

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    r = ni()
    print(2*math.pi*r)

if __name__ == "__main__":
    main()


Measured memory_bytes: 62044