akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
 ll a,b;
  cin >> a >> b;
	if (__gcd(a,b) == min(a,b) && a >= b)
      cout << -1 << endl;

  else
  {
    ll ret = a;
	while (ret % b == 0)
    {
      ret += a;
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const int inf=1e9+7;
const double eps=1e-6;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
const double pi=acos(-1);

ll a[203040];

int main()
{
    TB
    int n,k;
    cin>>n>>k;
    ll sum=0;
    fdd(1,n+1) cin>>a[i];
    fdd(1,n-k+1){
        if(a[i]<a[i+k])cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 5208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

string s;
int table1[] = { 2,1,0 };
int table2[3][3] = { { 0,1,2 },
					 { 1,1,2 },
					 { 2,2,2 } };
int table3[3][3] = { { 0,0,0 },
					 { 0,1,1 },
					 { 0,1,2 } };
int p, q, r;

int number(int &pos) {
	if (s[pos] == '0') {
		pos++;
		return 0;
	}
	if (s[pos] == '1') {
		pos++;
		return 1;
	}
	if (s[pos] == '2') {
		pos++;
		return 2;
	}
	if (s[pos] == 'P') {
		pos++;
		return p;
	}
	if (s[pos] == 'Q') {
		pos++;
		return q;
	}
	if (s[pos] == 'R') {
		pos++;
		return r;
	}
}

int formula(int &pos) {
	if (s[pos] == '-') {
		pos++;
		return table1[formula(pos)];
	}
	if (s[pos] == '(') {
		pos++;
		int res = formula(pos);
		if (s[pos] == '+') {
			pos++;
			res = table2[res][formula(pos)];
		}
		else if (s[pos] == '*') {
			pos++;
			res = table3[res][formula(pos)];
		}
		pos++;
		return res;
	}
	return number(pos);
}

int main() {
	while (cin >> s&&s != ".") {
		int ans = 0;
		rep(i, 3) {
			rep(j, 3) {
				rep(k, 3) {
					p = i;
					q = j;
					r = k;
					int pos = 0;
					if (formula(pos) == 2) {
						//cout << "!" << p << " " << q << " " << r << endl;
						ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3056
#include<stdio.h>

int main(void)
{
	int a,b,i;
	scanf("%d%d",&a,&b);
	
	if(a>=b){
		for(i=0;i<a;i++)
			printf("%d",b);
	}
	else
	{
		for(i=0;i<b;i++)
			printf("%d",a);
	}
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		int[] array = new int[3];
		array[0]=n;
		array[1]=m;
		array[2]=k;

		long count=0;
		Arrays.sort(array);

		/*if(n==m) {
			System.out.println(n*2);
		}else {
			System.out.println(Math.max(n, m)+Math.max(n, m)-1);
		}*/

		System.out.println(array[0]+array[1]);
	}
}




Measured memory_bytes: 21844
n, k = map(int, input().split())
arr = [0] * n
for i in range(k):
    d = int(input())
    okashi = list(map(int, input().split()))
    for j in range(d):
        arr[okashi[j] - 1] = 1
ans = 0
for i in range(n):
    if arr[i] == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 110000; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 5188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>	
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
//#define int ll
#define P pair<int,int>
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
int lcm(int a,int b){if(a==0){return b;} return a/gcd(a,b)*b;}

int n,m; 
vector<P> where[155];
int dp[155][1005][80]; // i,jは場所　k:  残りのループの回数

// d: 滑りやすさ left: 残りの飛ばせる回数
int saiki(int i,int j,int left,int d){
	if(i>=n) return 0;
	if(left&&(i>=n-1)) return 0;
	if(dp[i][j][left]<INF) return dp[i][j][left];
	
	for(int k=0; k<where[i+1].size(); k++){
		int j_to=where[i+1][k].first, dd=where[i+1][k].second;
		dp[i][j][left]=min(dp[i][j][left], saiki(i+1, j_to, left, dd)+(d+dd)*abs(j_to-j));
		dp[i][j][left]=min(dp[i][j][left], saiki(i+1, j_to, left, dd)+(d+dd)*abs(j_to-j));
	}
	if(left){
		for(int k=0; k<where[i+2].size(); k++){
			int j_to=where[i+2][k].first, dd=where[i+2][k].second;
			dp[i][j][left]=min(dp[i][j][left], saiki(i+2, j_to, left-1, dd)+(d+dd)*abs(j_to-j));
			dp[i][j][left]=min(dp[i][j][left], saiki(i+2, j_to, left-1, dd)+(d+dd)*abs(j_to-j));
		}
	}
//		cout<<"dp["<<i<<"]["<<j<<"]["<<left<<"]:  "<<dp[i][j][left]<<en;
	return dp[i][j][left];
}

signed main(){
	while(cin>>n>>m&&n){
		for(int i=0; i<=n+1; i++) where[i].clear();
		for(int i=1; i<=n; i++){
			int k; cin>>k;
			for(int j=0; j<k; j++){
				int a,b; cin>>a>>b;
				where[i].push_back(mk(a,b));
			}
		}
		for(int i=0; i<=153; i++) for(int j=0; j<=1002; j++) for(int k=0; k<80; k++) dp[i][j][k]=INF;
		
		int ans=INF;
		for(int i=0; i<where[1].size(); i++){
			ans=min(ans,saiki(1, where[1][i].first, m,where[1][i].second));
		}
		if(m){
			for(int i=0; i<where[2].size(); i++){
				ans=min(ans, saiki(2, where[2][i].first, m-1, where[2][i].second));
			}
		}
		cout<<ans<<en;
	}
}



Measured memory_bytes: 51504
#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 < (ll)(n); i++)
const ll mo=1000000007;
ll ans=0;
ll v[250001][4];
ll root[250001][2];

int main()
{
ll h,w;

cin >> h>>w;
int table[h][w]={};
rep(i,h)rep(j,w){
    cin >> table[i][j];
}

rep(i,h)rep(j,w){
    if(i%2==0){
    root[j+i*w][0]=i;
    root[j+i*w][1]=j;}
    else{
    root[j+i*w][0]=i;
    root[j+i*w][1]=w-j-1;}
}

ll coun=0;
rep(i,h*w-1){
    if(table[root[i][0]][root[i][1]]%2==1){
        table[root[i][0]][root[i][1]]--;
        table[root[i+1][0]][root[i+1][1]]++;
        v[coun][0]=root[i][0];
        v[coun][1]=root[i][1];
        v[coun][2]=root[i+1][0];
        v[coun][3]=root[i+1][1];
        coun++;
    }
}

cout << coun << endl;
rep(i,coun){
cout << v[i][0]+1<<' ' <<v[i][1]+1<<' ' <<v[i][2]+1<<' ' <<v[i][3]+1 << endl;
}
return 0;
}



Measured memory_bytes: 11264
a, b = map(int, raw_input().split())

if a == b:
    print(-1)
elif a > b and a%b == 0:
    print(-1)
else:
    x = a
    mult = 2
    fuck = False
    while (x * mult) % b == 0:
        mult = mult + 1
        if x * mult > 1e18:
            break
    if (x * mult)%b != 0 and x * mult <= 1e18:
        print(x*mult)
    else:
        print(-1)




Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;
ll d[100100];
int main(void){
  ll n;
  cin>>n;
  for(int i=0;i<n;i++) cin>>d[i];
  sort(d,d+n);
  cout<<d[n/2]-d[n/2-1]<<endl;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, X, diff[100001]; cin >> N >> X;
    rep(i, N) {
        int x;
        cin >> x;
        diff[i] = abs(X - x);
    }

    if (N == 1) {
        cout << diff[0] << endl;
    } else {
        int D = my_gcd(diff[0], diff[1]);
        for (int i = 2; i < N; ++i) {
            D = my_gcd(D, diff[i]);
        }

        cout << D << endl;
    }

    return 0;
}

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

long long  divv(long long m,long long n)
{
	long long x;
	long long a, b;
	a = m;
	b = n;
	if (a > b)
	{
		x = a%b;
	}
	else
	{
		x = a;
		a = b;
		b = x;
		x = a%b;
	}
	while (x != 0)
	{
		a = b;
		b = x;
		x = a%b;
	}
	return b;
}

int main()
{
    long long a1,b1,d1;
    scanf("%lld %lld",&a1,&b1);
    d1=divv(a1,b1);
    printf("%lld",(a1/d1)*b1);
}



Measured memory_bytes: 128
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, int> pdd;

const ll mod = 1e9 + 7;
const int N = 1e2 + 10, M = 1e3 + 10;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-10;

#define pi acos(-1)
#define mk make_pair

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = c - a - b;
    if (d < 0)
    {
        puts("No");
        return 0;
    }
    if (4 * a * b < d * d)
        puts("Yes");
    else
    {
        puts("No");
    }
    return 0;
}


Measured memory_bytes: 256
/*--------------------------*/
// p.87
// 4.3 キュー 
//
// ラウンドロビンスケジューリング（プロセス）
//
// 入力例：
//     5 100
//     p1 150
//     p2 80
//     p3 200
//     p4 350
//     p5 20
//
// 出力例：
//     p2 180
//     p5 400
//     p1 450
//     p3 550
//     p4 800
/*--------------------------*/


#include <stdio.h>
#include <string.h>

#define LEN 100005

/* プロセスを表す構造体 */
typedef struct pp{
  char name[100]; // 名前
  int time;       // 時間
}Process;

Process Q[LEN];
int head, tail;

/* enqueue */
void enqueue(Process x){
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}

/* dequeue */
Process dequeue(){
  Process x = Q[head];
  head = (head + 1) % LEN;
  return x;
}

int min(int a, int b){
  return a < b ? a : b;
}

int main(){
  int elaps = 0;
  int c, i;
  int n, q;
  Process u;

  scanf("%d %d", &n, &q); // n: プロセス数, q: 最大qms(クオンタム)

  /* 全てのプロセスをキューに順番に追加する */
  for(i = 1 ; i <= n ; i++){
    scanf("%s", Q[i].name);  // 名前
    scanf("%d", &Q[i].time); // 時間
  }
  head = 1;
  tail = n + 1;

  /* シミュレーション */
  while(head != tail){
    u = dequeue();
    c = min(q, u.time); // 消費した時間
    u.time -= c;
    elaps  += c; // トータル経過時間

    if (u.time > 0){
      enqueue(u);
    }else{
      printf("%s %d\n", u.name, elaps);
    }
  }

  return 0;
}




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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++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 irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  vi x(3);
  rep(i,3){
    cin>>x[i];
  }
  vsort(x);
  int d=x[2]-x[1];
  int ans=(x[2]-(d+x[0]))/2+d;
  if((x[2]-(d+x[0]))%2==1)ans+=2;
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N, M, K, Q, L;

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

    cin >> N >> L;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }

    int last = -1;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] + a[i + 1] >= L) {
            last = i;
        }
    }
    if (last == -1) {
        cout << "Impossible"
             << "\n";
        return 0;
    }
    vector<int> ans;

    for (int i = 0; i < last; i++) {
        ans.push_back(i);
    }
    for (int i = N - 2; i > last; i--) {
        ans.push_back(i);
    }
    ans.push_back(last);

    cout << "Possible"
         << "\n";
    for (int i = 0; i < (int)ans.size(); i++) {
        cout << ans[i] + 1 << "\n";
    }

    return 0;
}


Measured memory_bytes: 2168
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
 
class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();
		int N = Integer.parseInt(str);
		HashSet<String> hs = new HashSet<String> ();
		for(int i = 0;i < N ;i++) {
			str = br.readLine();
			if(hs.contains(str)) {
				hs.remove(str);
			}else {
				hs.add(str);
			}

		}
		System.out.println(hs.size());
	}
 
}

Measured memory_bytes: 32984
#include<bits/stdc++.h>
#define hell (int)(1e9+7)
#define int long long int
#define inf 1000000000000

using namespace std;

vector <int> tree,lazy,a;

void solve(){
    string s;
    cin>>s;
    if(s=="BBB"||s=="AAA")
        cout<<"No";
    else
        cout<<"Yes";
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t,c;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    a: f64,
    b: f64,
    x: f64,
  }
  if 2.0 * x < a * a * b {
    puts!("{:.15}\n", 90.0 - (2.0 * x / a / b / b).atan().to_degrees());
  } else {
    puts!("{:.15}\n", (2.0 * (a * b - x / a) / a / a).atan().to_degrees());
  }
}


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

H,W=map(int,input().split())
a = [list(input().split()) for _ in range(H)]
for i in range(H):
    a[i] = list(a[i][0])
MOD=1000000007
dp = [[0]*W for _ in range(H)]
dp[0][0]=1
for h in range(H):
    for w in range(W):
        if a[h][w]=="#": continue
        if h-1>=0: dp[h][w]+=dp[h-1][w]
        if w-1>=0: dp[h][w]+=dp[h][w-1]
        dp[h][w]%=MOD
print(dp[H-1][W-1])


Measured memory_bytes: 90992
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200001];
long long abss(long long x){
	if(x<0)return -x;
	return x;
}
long long x=0,y=0;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		y+=a[i];
	}
	long long minn=1e18;
	for(int i=0;i<n-1;i++){
		x+=a[i];
		y-=a[i];
		if(abss(x-y)<minn)minn=abss(x-y);
	}
	cout<<minn<<endl;
	return 0;
}

Measured memory_bytes: 1024
n=int(input())
s=str(input())

l=[]
c=s.count('E',1)
for i in range(1,n):
    if s[i-1]=='W':
        c+=1
    if s[i]=='E':
        c-=1
    l.append(c)
print(min(min(l),s.count('E')))


Measured memory_bytes: 15520
n = int(input())
ele = []
i = 1
while i * i <= n:
    if n % i == 0:
        ele.append([len(str(i)),len(str(n // i))])
    i += 1

k = max(ele[0][1],ele[0][0])
for i in range(len(ele)):
    k = min(max(ele[i][0],ele[i][1]),k)
print(k)

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

int main(){
    int N,NUM[100001];
    int a;
    cin >> N ;
    for(int i = 1;i < N+1;i++){
    cin >> NUM[i];
}
    NUM[0]= 0;
    NUM[N+1]=0;
    for(int i = 0; i < N+1; i++){
        a = a + abs(NUM[i]-NUM[i+1]);
    }
    for(int i = 1; i < N+1; i++){
        int x = a - abs(NUM[i]-NUM[i-1]) - abs(NUM[i]-NUM[i+1])+ abs(NUM[i-1]-NUM[i+1]);
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
from fractions import gcd
N=int(input())
def lcm(a,b):
    return a//gcd(a,b)*b
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
a=1
for i in range(N):
    a=lcm(a,T[i])

print(a)

Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define itn int
#define rep(i, n) for (int i = 0; i < n; i++)
#define irep(i,n) for(int i = n-1; i>=0; i--)
#define repeach(itr, k) for(auto itr : k)
#define MOD 1000000007
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

int main(){
    string s;
    cin >> s;
    char a='a';
    for(int i=0;i!=s.size();i++){
        if(s[i]!=a){
            a=s[i];
            continue;
        }
        else{
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n = s.length();
  for(int i = 0; i < n - 1; ++i){
    if(s[i] == s[i + 1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a + b + c) % 2){
        int d = max(a, max(b , c));
        int e;
        if(d % 2 == 0) e = (d + 1) / 2 * 2 + 1;
        else e = d;
        cout << (3 * e - a - b - c) / 2 << "\n";
    }else{
        int d = max(a, max(b , c));
        int e = (d + 1) / 2 * 2;
        cout << (3 * e - a - b - c) / 2 << "\n";
    }
}

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

int main(){
  string s, abc[6] = {"abc", "acb", "bac", "bca", "cab", "cba"};
  cin >> s;
  
  string ans = "No";
  for(int i = 0; i < 6; i++){
      if(s == abc[i]) ans = "Yes";
  }
    
  cout << ans << endl;
  return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K; cin >> N >> K;
    if (!K){cout << N*N << '\n'; return 0;}
    ll ans=0;
    for (ll i=K+1;i<=N;++i){
        ans+=N/i*(i-K)+max(N%i-K+1,0LL);
    }
    cout << ans << '\n';
}

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

class Program
{
    static void Main(string[] args)
    {
        // 入力
        long[] tmp = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] h = Console.ReadLine().Split().Select(long.Parse).ToArray();

        //配列を昇順でソート
        Array.Sort(h);
        long ans = 0;
        for (long i = 0; i < tmp[0] - tmp[1]; i++)
        {
            ans += h[i];
        }

        Console.WriteLine(ans);

    }
}


Measured memory_bytes: 37376
N = int(input())
S = input()

score = [0] * N
# i番目の人がリーダーの時の、W->Eの変化を数える
counter = 0
for i in range(N):
    score[i] += counter
    if S[i] == 'W':
        counter += 1

# i番目の人がリーダーの時の、E->Wの変化を数える
counter = 0
for i in range(N):
    i = N - i - 1
    score[i] += counter
    if S[i] == 'E':
        counter += 1

print(min(score))

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int n; cin >> n;
    V<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    for(int i = n - 1; i > 0; i--){
        if(a[i] < a[i - 1]){
            a[i - 1]--;
        }
    }

    for(int i = n - 1; i > 0; i--){
        if(a[i] < a[i - 1]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;


    return 0;
}


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

using namespace std;

int main() {

    string s;
    cin>>s;
    int idx = s.find(",");
    while(idx!=-1){
        s.replace(idx,1," ");
        idx = s.find(",",idx+1);
    }
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main{
  static int[] ans;
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String S = sc.next();
    
    int r = 0, b = 0;
    for(int i = 0; i < N; i++){
      if(S.charAt(i) == 'R'){
        r++;
      }else{
        b++;
      }
    }
    System.out.println(r > b ? "Yes" : "No");
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)

using namespace std;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int pw2(int i, int n) {
  if (i == 0) return 1;
  if ((i%2) == 1) return min(n, 2*pw2(i-1, n));
  int h = pw2(i/2, n);
  return min(n, h*h);
}

int main()
{
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  char mn = *boost::min_element(s);
  int cnt = 0;
  string t = s;
  boost::reverse(t);
  string st = s + t + "~";
  int mxlen = 0;
  vecint starts;
  REP(i,2*n+1) {
    if(st[i] == mn) {
      ++cnt;
    } else {
      if (cnt > mxlen) starts.clear();
      if (cnt >= mxlen) {
        starts.push_back(i-cnt);
        mxlen = cnt;
      }
      cnt = 0;
    }
  }
  if (k == 1) {
    string res(n, mn+1);
    REP(i,n) {
      res = min(res, st.substr(i, n));
    }
    cout<<res<<endl;
    return 0;
  }
  int len = min(n, mxlen * pw2(k-1, n));
  if (len == n) {
    cout<<string(n, mn)<<endl;
    return 0;
  }
  int rem = n-len;
  string res(n, mn+1);
  string prefix(len, mn);
  for (int stt : starts) {
    if (stt + mxlen < n) continue;
    auto tmp = st.substr(stt-rem, rem) + prefix;
    boost::reverse(tmp);
    res = min(res, tmp);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
    ll N, K;
    cin >> N >> K;
    ll ans = K;
    for (int i = 1; i < N; i++)
    {
        ans *= (K - 1);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans=0;
  int sa = -1;
  int sizes = s.size();
  for(int i=0;i<sizes;i++){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
    } else {
      ans = max(ans,i-sa-1);
      sa = i;
    }
    if(i==sizes-1&&(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')){
      ans = max(ans,i-sa);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math

def solve(N: int, K: int):
    print(str(math.floor(math.log(N,K))+1))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			String s = sc.next();
			String t = sc.next();
			
			int count = 0;
			for(int i = 0; i < s.length();i++) {
				if(s.charAt(i) != t.charAt(i)) {
					count++;
				}
			}
			System.out.println(count);




		}catch(Exception e) {
			e.printStackTrace();
		}

	}

	
}

Measured memory_bytes: 41316
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(),(x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 500001;
const ld EPS = 1e-9;
int hp = 179;

signed main()
{
	fastio();
	int n, k;
	cin >> n >> k;
	cout << (n%k ? 1 : 0);
	system("pause");
}

Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+1000;
ll infi=1e18+100;
 
ll n;
ll a[100005];
int main() {
	cin>>n;
	Rep(i,n) cin>>a[i];
	if(a[0]<0)Rep(i,n)a[i]=-a[i];
	a[n]=0;
	ll sum=a[0];
	ll ans=0;
    if(a[0]==0){sum++;ans++;}
	rep(i,n-1){
		ll p=sum;
		sum+=a[i];
		if(p<0 && sum<=0){
			ans+=(1-sum);
			sum=1;
		}
		else if(p>0 && sum>=0){
			ans+=(sum+1);
			sum=-1;
		}

	}
	ll anss=1+a[0];
	sum=-1;
	rep(i,n-1){
			ll p=sum;
			sum+=a[i];
			if(p<0 && sum<=0){
				anss+=(1-sum);
				sum=1;
			}
			else if(p>0 && sum>=0){
				anss+=(sum+1);
				sum=-1;
			}

		}
	cout<<min(ans,anss)<<endl;
 
 
 
	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int a, b, c;
    cin >> a >> b >> c;
    if ((a + b + c) >= 22) {
        cout << "bust" << '\n';
    } else {
        cout << "win" << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int f = 1;
    for (int i = 1; i <= n; i++) f *= i;
    vector<pair<int, int>> xy(n);
    for (auto& e : xy) cin >> e.first >> e.second;
    vector<int> s(n);
    iota(begin(s), end(s), 0);
    double ans = 0;
    do {
        for (int i = 0; i + 1 < n; i++) {
            ans += hypot(xy[s[i]].first - xy[s[i+1]].first, xy[s[i]].second - xy[s[i+1]].second);
        }
    } while (next_permutation(begin(s), end(s)));

    cout << fixed << setprecision(10) << ans / f << endl;
}


Measured memory_bytes: 256
def count(nums):
    """count the number of inversions (ai > aj and i < j)
    in a sequence of ints num.

    >>> count([3, 5, 2, 1, 4])
    6
    >>> count([10, 2, 9, 4, 6, 5, 7, 8, 3, 1])
    29
    """
    def _count(i, j):
        if i < j:
            mid = (i + j) // 2
            i1, li1 = _count(i, mid)
            i2, li2 = _count(mid+1, j)

            return _merge(li1, li2, i1 + i2)
        else:
            return (0, nums[i:i+1])

    def _merge(li1, li2, invs):
        i = j = 0
        result = []
        sums = inv = 0
        while i < len(li1) and j < len(li2):
            if li1[i] > li2[j]:
                result.append(li2[j])
                inv += 1
                j += 1
            else:
                result.append(li1[i])
                invs += sums + inv
                sums += inv
                inv = 0
                i += 1

        while i < len(li1):
            result.append(li1[i])
            invs += sums + inv
            sums += inv
            inv = 0
            i += 1
        if j < len(li2):
            result.extend(li2[j:])

        return (invs, result)

    invs, _ = _count(0, len(nums))
    return invs

def run():
    _ = int(input())  # flake8: noqa
    nums = [int(i) for i in input().split()]

    print(count(nums))


if __name__ == '__main__':
    run()



Measured memory_bytes: 27496
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		int sum = sc.nextInt();
		int ct = 0;
		for(int i = 0; i <= max; i++){
			for(int j = 0; j<= max; j++){
				int tmp = sum - i - j;
				if(tmp <= max && tmp >= 0)
					ct ++;
			}
		}
		System.out.println(ct);
	}
}

Measured memory_bytes: 23124
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
ans = -1
for i in range(1000):
	s = str(i)
	if len(s) == n:
		flag = 0
		for (x, y) in a:
			if int(s[x-1]) != y:
				flag = 1
		if flag == 0:
			ans = i
			break

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
typedef long long LL;
const LL mod = 1e9 + 7;
const int N = 3e5 + 5;

char a[N], b[N];
int n, m, ans = 1e9;

int main() {
	cin>>(a + 1)>>(b + 1);
	n = strlen(a + 1), m = strlen(b + 1);
	rep(i, 1, n - m + 1) {
		int res = 0;
		rep(j, 1, m)
		    if(a[i + j - 1] != b[j]) res++;
		ans = min(ans, res);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3628
module Main where

import Control.Applicative
import Control.Monad.State
import Data.List

work :: State (String, String) ()
work = do
    (s:sx, t) <- get
    case s of
        'B' -> if null t then put (sx, t) else put (sx, init t)
        _   -> put (sx, t ++ [s])
    unless (null sx) work

main :: IO ()
main = do
    line <- getLine
    putStrLn $ snd $ execState work (line, "")


Measured memory_bytes: 380
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define len length()
#define sz size()
#define REP(i, n) for(int i = 0; i < n; i++)
#define SORT(v) sort(v.begin(), v.end())
#define veci(a, n) vector<int> a(n)
#define vecs(a, n) vector<string> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define SP(n) cout << setprecision(n) << fixed

int main(){
    string s;
    cin >> s;
    cout << s.at(0) << s.len - 2 << s.at(s.len - 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}





int main(){
  double L;
  cin >> L;
  double ans = (L/3)*(L/3)*(L/3);
  printf("%lf\n",ans);
  return 0;
}



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

int main () {
	string r1,r2;
	cin >> r1;
	cin >> r2;
	// A B C
	// D E F
	// Rotate 180 Degrees
	// FED, CBA?
	if (r2[2] == r1[0] && r2[1] == r1[1] && r2[0] == r1[2])
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
n,k = gets.split(' ').map(&:to_i)
r,s,p = gets.split(' ').map(&:to_i)
line = gets
#puts line
sum =0
#line.gsub!(/r/,'tama')
#puts line

 j = Array.new(k,0)
 #puts k
wari = n/k
#puts wari

for i in 0..k-1
  if line[i]=="r"
    sum+=p
  elsif line[i] == "s"
    sum+=r
  elsif line[i] == "p"
    sum+=s
  end
  #puts "syoki"
  #puts sum
end

if wari > 1
 for i in 1..wari-1
   for u in 0..k-1
     if line[i*k+u]==line[i*k+u-k] && j[u] == 1
       if line[i*k+u]=="r"
         sum+=p
       elsif line[i*k+u] == "s"
         sum+=r
       elsif line[i*k+u] == "p"
         sum+=s
       end
       j[u] = 0
   elsif line[i*k+u]==line[i*k+u-k] && j[u] == 0
     j[u] = 1
   else
     if line[i*k+u]=="r"
       sum+=p
     elsif line[i*k+u] == "s"
       sum+=r
     elsif line[i*k+u] == "p"
       sum+=s
     end
     j[u] = 0
   end
   #puts "middle"

   #puts sum
 end
end
end


t = 0
if wari>0
  for i in wari*k..n-1

    if line[i] == line[i-k] && j[t] == 1
      if line[i]=="r"
        sum+=p
      elsif line[i] == "s"
        sum+=r
      elsif line[i] == "p"
        sum+=s
      end
    elsif line[i] == line[i-k] && j[t] == 0
      sum+=0
    else
      if line[i]=="r"
        sum+=p
      elsif line[i] == "s"
        sum+=r
      elsif line[i] == "p"
        sum+=s
      end
    end
    t+=1
  end

  #puts "last"
  #puts sum
end


puts sum


Measured memory_bytes: 2556
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[1000];

void push(int x)
{
	//topを加算してその位置に挿入
	S[++top] = x;
}
int pop()
{
	top--;
	//topの指していた要素を返す
	return S[top+1];
}
int main()
{
	int a, b;
	top = 0;
	char s[100];
	while(scanf("%s", s) != EOF)
	{
		if(s[0] == '+')
		{
			a = pop();
			b = pop();
			push(a+b);
		}else if(s[0] == '-')
		{
			b = pop();
			a = pop();
			push(a-b);
		}else if(s[0] == '*')
		{
			a = pop();
			b = pop();
			push(a*b);
		}else
		{
			push(atoi(s));
		}
	}
	printf("%d\n", pop());
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  for(int i = 0; i < S.size(); i++) {
    if(S.at(i) != S.at(S.size() - (i + 1)) || S.at(0) != S.at((S.size() - 2) / 2)) {
      cout << "No" << endl;
      break;
    }
    else if(i == S.size() - 1) {
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define D(x) cout<<"D: "<<#x<<'='<<x<<endl;
#define R(x, l) cout<<"R: Array "<<#x<<endl; for(int i = 0; i < l; i++) cout<<' '<<i<<':'<<*(x+i)<<endl;
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	for(unsigned i = 0; i < v.size(); i++) os<<v[i]<<' ';
	return os;
}
vector<int> v;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, cnt = 0;
	cin>>a>>b;
	for(int i = 0; i < a; i++) v.pb(2);
	for(int i = 0; i < b; i++) v.pb(1);
	for(int i = 0; i < v.size(); i++)
		for(int j = i+1; j < v.size(); j++)
			if (!((v[i]+v[j])%2)) cnt++;
	cout<<cnt<<endl;
	return ~~(0-0);
}

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

using namespace std;

#define il inline
#define re register
#define Rep(i, s, e) for (re int i = s; i <= e; ++i)
#define Dep(i, s, e) for (re int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)

il int read() {
    int x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = false; c = getchar();}
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}

map <string, bool> M;

int n, ans;

int main() {
    n = read();
    while (n--) {
        string s;
        cin >> s;
        if (!M[s]) ++ans, M[s] = true;
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 19152
# coding: utf-8
import sys

n = int(raw_input())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
c = map(int, raw_input().split())


count = 0

for i in xrange(n):
    #print i,a[i], b[a[i]-1]  
    count += b[a[i]-1]
    if i > 0 and a[i] == a[i-1] + 1:
        count += c[a[i-1]-1]
        #print c[a[i-1]-1]
print count

Measured memory_bytes: 2568
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define N 300005
#define vi vector<int>
#define all(v) v.begin(),v.end()
double dp[3005][3005];
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   double p[n];
   dp[0][0]=1;
   for(int i=1;i<=n;i++)
   {   cin>>p[i];
       for(int j=0;j<i;j++)
       {
           dp[i][j+1]+=dp[i-1][j]*p[i];
           dp[i][j]+=dp[i-1][j]*(1-p[i]);
       }
   }
   double res=0;
   for(int i=(n/2)+1 ; i<=n;i++)
   {
       res+=dp[n][i];
   }
   cout<<fixed<<setprecision(15)<<res<<endl;
}


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

int main(){

    int a,b,c;
    cin >> a >> b >> c;
    int remain = a % b;

    for(int i=1; i<=b; i++){
        if(remain * i % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
a, w, t, r = 0, 0, 0, 0
for _ in range(N):
    S = input()
    if S == 'AC':
        a += 1
    elif S == 'WA':
        w += 1
    elif S == 'TLE':
        t += 1
    else:
        r += 1
print('AC x ' + str(a))
print('WA x ' + str(w))
print('TLE x ' + str(t))
print('RE x ' + str(r))

Measured memory_bytes: 9168
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#pragma warning(disable:4996)
int main()
{
	char Work[256];

	int Num[2];
	int Divide;
	int nCnt2,nCnt = 0, Result, Keta = 1;

	while (gets(Work))
	{
		for (nCnt = 0; Work[nCnt] != '\0'; nCnt++)
		{
			if (Work[nCnt] == ' ')
			{
				char Work2[256];
				char Work3[256];

				strcpy(Work2, &Work[nCnt]);

				Work[nCnt] = '\0';

				strcpy(Work3, Work);

				Num[0] = atoi(Work3);
				Num[1] = atoi(Work2);
				break;
			}
		}

		Result = Num[0] + Num[1];

		Keta = 1;
		for (nCnt = 0; ;nCnt++)
		{
			Result = Result / 10.0f;

			if (Result > 0)
				Keta++;
			else
				break;
		}

		printf("%d\n", Keta);
	}
	
	return 0;
}

Measured memory_bytes: 964
#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;}
const ll INF = 1LL<<60;
const ll M = pow(10,9)+7;
/*template*/

bool iskaibun(string str){
  ll n=str.length();
  for(ll i=0;i<(n+1)/2;i++){
    if(str[i]!=str[n-1-i])return false;
  }
  return true;
}


int main()
{
  string s;cin>>s;
  ll n=s.length();
  string s2=s.substr(0,(n-1)/2);
  if(iskaibun(s) && iskaibun(s2)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>

using ll = long long;
ll h, w, m;

int main(){
    std::cin >> h >> w >> m;
    std::vector<ll> H(m), W(m), Hcnt(h, 0), Wcnt(w, 0);
    ll hmax = 0, wmax = 0;
    for(int i = 0; i < m; i++){
        std::cin >> H[i] >> W[i];
        H[i]--; W[i]--;
        Hcnt[H[i]]++;
        Wcnt[W[i]]++;
        hmax = std::max(hmax, Hcnt[H[i]]);
        wmax = std::max(wmax, Wcnt[W[i]]);
    }

    std::set<ll> hh, ww;
    for(int i = 0; i < h; i++){
        if(Hcnt[i] == hmax) hh.insert(i);
    }
    for(int i = 0; i < w; i++){
        if(Wcnt[i] == wmax) ww.insert(i);
    }

    ll h_size = hh.size(), w_size = ww.size();
    ll tmp = h_size * w_size;
    for(int i = 0; i < m; i++){
        if(hh.find(H[i]) != hh.end() && ww.find(W[i]) != ww.end()){
            tmp--;
        }
    }

    if(tmp == 0) std::cout << hmax + wmax - 1 << std::endl;
    else std::cout << hmax + wmax << std::endl;
    return 0;
}


Measured memory_bytes: 40740