akhauriyash/Code-Regression huggingface dataset:
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;



int main(){
    
    ll l,r;cin>>l>>r;
    ll MIN=222323;
    if(r-l>=2018){
        cout<<0<<endl;
        return 0;
    }
    else{
        for(ll i=l;i<r+1;i++){
            for(ll j=i+1;j<r+1;j++){
                MIN=min(MIN,((i%2019)*(j%2019))%2019);
            }
        }
        cout<<MIN<<endl;
    }
}






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

using namespace  std;

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

	vector<int> b(n - 1);
	for (int i = 0; i < n - 1; i++) {
		cin >> b.at(i);
	}

	if (n == 2) {
		cout << b.at(0) * 2 << endl;
	}
	
	else {
		int cnt = 0;

		cnt += b.at(0);

		for (int i = 1; i < n - 1; i++) {
			if (b.at(i) > b.at(i-1)){
				cnt += b.at(i-1);
			}

			else{
				cnt += b.at(i);
			}
		}
		cnt += b.at(n - 2);
		cout << cnt << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second

typedef long long ll;

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;
}

struct UnionFind
{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

/*要注意*/
void solve1()
{
    int n; cin >> n;
    vector<ll> a(n);
    set<ll> s; 
    rep(i, n)  {
        cin >> a[i];
        s.insert(a[i]);
    }

    vector<ll> as(a);
    sort(all(a), greater<int>());
    sort(all(as));
    map<ll, ll> m;
    ll ans = 0;

    for(auto itr = s.begin(); itr != s.end(); itr++) {
        ll num = upper_bound(all(as), *itr) - lower_bound(all(as), *itr);
        m[*itr] = num;
    }

    for(auto itr = s.rbegin(); itr != s.rend(); itr++) {
        if(n >= 2*m[*itr]) {
            ans += 2*m[*itr]*(*itr);
            n -= 2*m[*itr];
        } else {
            ans += (*itr)*(n);
            break;
        }

        if(n <= 0) {
            break;
        }
    }

    ans -= a[0];
    cout << ans << endl;
}

int main()
{
    solve1();
}


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

#define INF 1e9 + 5

// for using in pairs
#define F first
#define S second

// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;


void solve(int tc)
{
	int n;
	cin >> n;

	ll time = 0;

	pair<int, int> a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i].F >> a[i].S;

	sort(a, a + n, [](auto& a, auto& b)
	{
		return a.S < b.S;
	});

	for (int i = 0; i < n; i++)
	{
		time += a[i].F;
		if (time > a[i].S)
			return void(cout << "No\n");
	}
	cout << "Yes\n";
}

int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

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

	int t = 1;
	// cin >> t;

	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}
	return 0;
}


Measured memory_bytes: 5204
A,B = list(map(int,input().split()))
count = 0
for i in range(A,B+1):
  x = i
  a1 = x//10000
  x = x - 10000*a1
  a2 = x//1000
  x = x - 1000*a2
  a3 = x//100
  x = x - 100*a3
  a4 = x//10
  a5 = x - 10*a4
  if a1 == a5 and a2 == a4:
    count +=1
    
print(count)

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

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll op = a + b;
    ll ans;
    if(a == 0) ans = 0;
    else{
        if(n % op == 0) ans = n / op * a;
        else{
            if(n%op >= a) ans = n/op*a + a;
            else ans = n/op*a + n%op;
        }
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
char buf[1<<20],*p1,*p2;
#define GC (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?0:*p1++)
template<class T> inline void read(T &n){
	char ch=GC;T w=1,x=0;
	while(!isdigit(ch)){if(ch=='-') w=-1;ch=GC;}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=GC;}
	n=x*w;
}
const int maxn=200005;
#define pii pair<int,int>
#define fir first
#define sec second
int n,m,top,st[maxn];
pii a[maxn];
bool cmp(pii x,pii y){
	return x.fir!=y.fir?x.fir<y.fir:x.sec>y.sec;
}
priority_queue <int,vector<int>,greater<int> > Q;
int main(){
	read(n),read(m);
	for(int i=1;i<=n;i++) read(a[i].fir),read(a[i].sec);
	sort(a+1,a+n+1,cmp);
	int L=1,R=m;
	for(int i=1;i<=n;i++){
		Q.push(a[i].sec);
		if(L<=R&&L<=a[i].fir) L++;
		else{
			st[++top]=Q.top();
			Q.pop();
		}
	}
	sort(st+1,st+top+1);
	int ans=0;
	for(int i=top;i>=1;i--){
		if(L<=R&&R>=st[i]) R--;
		else ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4216
Scanf.scanf "%d %d" (
  fun a b ->
  let ar = (a+1) * 100 / 8
  and al = (a * 100 - 1) / 8 + 1
  and br = (b+1) * 10
  and bl = b * 10 in
  let ans =
    if ar - al >= 1 && br - bl >= 1 && max al bl < min ar br then
      max al bl
    else ~-1
  in
  print_int ans
)


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
int n;
string s;
string sw = "SW";

int ans[111111];
bool ssolve(){
  for(int i = 2; i < n; i++){
    ans[i] = (ans[i-2]+(s[i-1]=='o'?0:1)+ans[i-1])%2;
  }
  return (ans[0] == (ans[n-2]+(s[n-1]=='o'?0:1)+ans[n-1])%2) &&
         (ans[1] == (ans[n-1]+(s[0]=='o'?0:1)+ans[0])%2);
}
bool solve(){
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 2; j++){
      ans[0] = i;
      ans[1] = j;
      if(ssolve()) return true;
    }
  }
  return false;
}

int main(void){
  cin >> n >> s;
  if(solve()){
    for(int i = 0; i < n; i++){
      cout << sw[ans[i]];
    }
    cout << endl;
  }else{
    cout << -1 << endl;
  }
}


Measured memory_bytes: 1024
import math

def d_len(x):
  return len(str(x))

n=int(input())
rt=int(math.sqrt(n))
min_ab=10**10
for a in range (1,rt+1):
  if n % a !=0:
    continue
  b=n//a
  f_ab=max(d_len(a),d_len(b))
  min_ab=min(min_ab,f_ab)
print(min_ab)

Measured memory_bytes: 9188
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] c = br.readLine().toCharArray();
		for (int i = 0; i < c.length; i++) {
			if (65 <= c[i] && c[i] <= 90) c[i] += 32;
			else if (97 <= c[i] && c[i] <= 122) c[i] -=32;
		}
		System.out.println(String.valueOf(c));
	}
}

Measured memory_bytes: 24436
#include <iostream>
#include <utility>
#include <stack>
#include <algorithm>
#include <vector>

using namespace std;

int R, C, N;

struct point{
	int x, y;
	point(int a, int b){
		x = a, y = b;
	}
	bool operator<(const point& obj)const{
		int type1, type2;
		if(y == 0) type1 = 0;
		if(x == R) type1 = 1;
		if(y == C) type1 = 2;
		if(x == 0) type1 = 3;
		if(obj.y == 0) type2 = 0;
		if(obj.x == R) type2 = 1;
		if(obj.y == C) type2 = 2;
		if(obj.x == 0) type2 = 3;
		
		if(type1 < type2) return true;
		if(type1 == type2){
			if(type1 == 0) return x < obj.x;
			if(type1 == 1) return y < obj.y;
			if(type1 == 2) return x > obj.x;
			if(type1 == 3) return y > obj.y;
		}
		return false;
	}
};

vector< pair<point, int> > vec;
stack<int> stk;

int main(void)
{
	cin >> R >> C >> N;
	int x1, y1, x2, y2;
	for(int i = 0; i < N; i++){
		cin >> x1 >> y1 >> x2 >> y2;
		if(x1 == 0 || x1 == R || y1 == 0 || y1 == C){
			if(x2 == 0 || x2 == R || y2 == 0 || y2 == C){
				vec.push_back( make_pair(point(x1, y1), i) );
				vec.push_back( make_pair(point(x2, y2), i) );
			}
		}
	}
	sort(vec.begin(), vec.end());
	
	int size = vec.size();
	for(int i = 0; i < size; i++) vec.push_back( vec[i] );
	
	for(int i = 0; i < vec.size(); i++){
		if(stk.size() && stk.top() == vec[i].second) stk.pop();
		else stk.push(vec[i].second);
	}
	
	if(stk.size()) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 8560
c = [[int(i) for i in input().split()] for i in range(3)] 

ans = False

for a_1 in range(101):
	b_1 = c[0][0] - a_1
	b_2 = c[0][1] - a_1
	b_3 = c[0][2] - a_1
	a_2 = c[1][0] - b_1
	a_3 = c[2][0] - b_1
	if 	a_2+b_2==c[1][1] and a_2+b_3==c[1][2] and a_3+b_2==c[2][1] and a_3+b_3==c[2][2]:
		ans = True
		break

if ans:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
import fractions
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = map(int,input().split())
GCD = fractions.gcd(A,B)
pf = prime_factorize(GCD)
print(len(set(pf))+1)

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

#define pr pair<int, int>

using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;

#define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

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;
}

// int a[10010][10010], b[1000];
// int dp[10010][3];

int main() {
    
    ll K,A,B; cin >> K >> A >> B;

    bool res = false;
    for(int i=A; i<=B; i++){
        if(i%K == 0){
            res = true;
        }
    }
    if(res){
        cout<<"OK"<<endl;
    }
    else{
        cout<<"NG"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3632
def read_input():
    n = int(input())

    slist = []
    for i in range(n):
        slist.append(input().strip())

    return n, slist

def submit():
    n, slist = read_input()

    slist.sort(key=lambda x: len(x))

    slist = [[c for c in s] for s in slist]

    checker = [c for c in slist[0]]
    result = []
    for c in checker:
        for s in slist[1:]:
            if c not in s:
                break
        else:
            result.append(c)
            for s in slist[1:]:
                s.remove(c)

    result.sort()
    print(''.join(result))

if __name__ == '__main__':
    submit()

Measured memory_bytes: 39152
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
vector<int> v[200001];
vector<int> cnt(200001,0);
vector<int> coun(200001,0);

void saiki(int ne){

    cnt[ne]+=coun[ne];
    rep(i,v[ne].size()){
        cnt[v[ne][i]]+=cnt[ne];
        saiki(v[ne][i]);
    }
    return ;


}

int main() {


    int n,q;
    cin>>n>>q;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
    }
    rep(i,q){
        int a,b;
        cin>>a>>b;
        coun[a]+=b;
    }

    saiki(1);
    int ans=0;


    for(int i=1;i<n+1;i++){
        cout<<cnt[i]<<" ";
    }








    return 0;
}


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

using namespace std;

#define foru(i, l, r) for (register int i = l; i <= r; i++)
#define ford(i, r, l) for (register int i = r; i >= l; i--)

typedef long long ll;
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll N, prime[20003], p_cnt, Need, a[505][505];

int main() {
  srand(time(0));
  for (int i = 2; i <= 20000; i++) {
    bool flag = true;
    for (int j = 2; j * j <= i && flag; j++)
      if (i % j == 0) flag = false;
    if (flag) prime[++p_cnt] = i;
  }
  scanf("%lld", &N), Need = N + N - 2;
  if(N == 2) {
    puts("4 7");
    puts("23 10");
    return 0;
  }
  //  random_shuffle(prime + 1, prime + Need + 1);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      if (!((i + j) & 1)) continue;
      int x = (i + j) >> 1;
      int y = ((N - (N & 1)) - (j - i) + 1) >> 1;
      a[i][j] = prime[x] * prime[N - 1 + y];
    }
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      if ((i + j) & 1) continue;
      a[i][j] = 1;
      if (i > 1) a[i][j] = lcm(a[i][j], a[i - 1][j]);
      if (j > 1) a[i][j] = lcm(a[i][j], a[i][j - 1]);
      if (i < N) a[i][j] = lcm(a[i][j], a[i + 1][j]);
      if (j < N) a[i][j] = lcm(a[i][j], a[i][j + 1]);
      a[i][j]++;
    }
  }
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++) printf("%lld%c", a[i][j], " \n"[j == N]);
  return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;

int main()
{
int arr[3][3];
int n;
for(int i=0;i<3;i++)
rep(j,0,3)
cin>>arr[i][j];
cin>>n;
int a[n];
rep(i,0,n)
{
	int x;
	cin>>x;
	rep(j,0,3)
	rep(k,0,3)
	if(x==arr[j][k])
	arr[j][k]=0;
}
bool b=false;
if(arr[0][0]+arr[1][1]+arr[2][2]==0)
b=true;
for(int i=0;i<3;i++)
{
	int x=0,y=0;
	rep(j,0,3)
	{
		x+=arr[i][j];
		y+=arr[j][i];
	}
	if(!x)
	b=true;
	if(!y)
	b=true;
}
if(arr[2][0]+arr[1][1]+arr[0][2]==0)
b=true;
if(b)
cout<<"Yes";
else
cout<<"No";
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; ++i) {
		int p;
		cin >> p;
		v.push_back(p);
	}
	int cnt = 0;
	for (int i = 0; i < v.size(); ++i) {
		if (v[i] == i + 1) {
			// swaped two value satisfy the condition
			++cnt;
			++i;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve(void)
{
  int X;cin>>X;
  for (int b = -1000; b <= 1000; b++)
  {
    for (int a = -1000; a < 1000; a++)
    {
      if(pow(a,5) - pow(b,5) == X)
      {
        cout<<a<<" "<<b<<endl;
        return;
      }
    }
    
  }
  
  
  return;
}

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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 4096
#include<cstdio>
#define maxn 4005
#define mod 924844033
int n,k,tot,dp[maxn][maxn][2],f[maxn],fact[maxn],ans;
bool vis[maxn][2],ed[maxn];
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		for(int j=0;j<=1;j++)
			if(!vis[i][j])
			{
				int len=0;
				for(int x=i,y=j;x<=n;x+=k,y^=1) vis[x][y]=1,len++;
				tot+=len; ed[tot]=1;
			}
	ed[0]=true; dp[0][0][0]=1;
	for(int i=0;i<2*n;i++)
		for(int j=0;j<=n;j++)
		{
			dp[i+1][j][0]=(dp[i][j][0]+dp[i][j][1])%mod;
			if(!ed[i]) dp[i+1][j+1][1]=dp[i][j][0];
		}
	for(int i=0;i<=n;i++) f[i]=(dp[n*2][i][0]+dp[n*2][i][1])%mod;
	fact[0]=1;
	for(int i=1;i<=n;i++) fact[i]=1ll*fact[i-1]*i%mod;
	for(int i=0,j=1;i<=n;i++,j=-j) ans=(ans+1ll*j*f[i]*fact[n-i]%mod)%mod;
	printf("%d\n",(ans+mod)%mod);
}

Measured memory_bytes: 124544
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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 main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    cout << S.substr(0,3) << "\n";

    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
 
#define MAX 5000 //最大項数
 
void func_init(int array[], int n);
int func_cal(int array[], int n);
 
main()
{
    int n = 0, i = 0, sum_max = 0; //項数代入用変数n,ループ制御変数i,最大合計値代入変数sum_max
    while(1) //nが0でない限り
    {
    	scanf("%d", &n);
    	if(n == 0)
    	{
    		break;
    	}
        int numbers[n]; //入力された値をを代入する配列
        func_init(numbers, n); //配列の初期化
        for(i = 0; i < n; i++)
        {
            scanf("%d", &numbers[i]); //入力をnumbersのi番目に代入
        }
        sum_max = func_cal(numbers, n);
        printf("%d\n", sum_max);
    }
    return 0;
}
void func_init(int array[], int n)
{
    int i = 0;
    for(i = 0; i < n; i++)
    {
        array[i] = 0;
    }
}
int func_cal(int array[], int n)
{
    int i = 0, j = 0, temp = -100000;
    int max = -100000;
	
    for(i = 0; i < n; i++)
    {
    	for(j = i; j < n; j++)
    	{
    		temp += array[j];
    		if(i == j)
    		{
    			temp = array[i];
    		}
    		if(max < temp)
    		{
    			max = temp;
    		}
    	}
    }
    return max;
}

Measured memory_bytes: 608
#include <iostream>
#include <stack>
#include <string>

using namespace std;

string s;
stack <long long> S;
long long a, b;

long long StrToInt(string s)
{
	long long x = 0, semn=1, ok=0;
	if (s[0] == '-')
	{
		semn = -1;
		ok = 1;
	}
	for (long long i = ok; i < s.size(); i++)
		x = x * 10 + s[i] - '0';
	return x * semn;
}

int main(){
	while (cin >> s)
	{
		if (s[0] == '+')
		{
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push(a + b);
		}
		else if (s[0] == '*')
		{
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push(a * b);
		}
		else if (s[0] == '-' && s.size()==1)
		{
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push(b - a);
		}
		else
		{
			long long x = StrToInt(s);
			S.push(x);
		}
	}
	cout << S.top() <<'\n';
}


Measured memory_bytes: 3136
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
typedef struct dice{
    int face[6];
}dice;
 
void rotate(dice *d, char dir)
{
    int temp;
    switch(dir) {
    case 'N':
        temp=d->face[0];
        d->face[0]=d->face[1];
        d->face[1]=d->face[5];
        d->face[5]=d->face[4];
        d->face[4]=temp;
        break;
    case 'E':
        temp=d->face[0];
        d->face[0]=d->face[3];
        d->face[3]=d->face[5];
        d->face[5]=d->face[2];
        d->face[2]=temp;
        break;
    case 'W':
        temp=d->face[0];
        d->face[0]=d->face[2];
        d->face[2]=d->face[5];
        d->face[5]=d->face[3];
        d->face[3]=temp;
        break;
    case 'S':
        temp=d->face[0];
        d->face[0]=d->face[4];
        d->face[4]=d->face[5];
        d->face[5]=d->face[1];
        d->face[1]=temp;
        break;
    }
}
 
void rotateto(dice *d, int t, int f)
{
    static const char dir[]="NNNESSSWNNNESSSWNNNESSSW";
    int i;
    for(i=0; i<24; i++) {
        if(d->face[0]==t && d->face[1]==f) 
            return;
        rotate(d, dir[i]);
    }
}
 
int main()
{
    dice d;
    int i, n;
    for(i=0; i<6; i++) {
        scanf("%d", &d.face[i]);
    }
    scanf("%d", &n);
    int t, f;
    for(i=0; i<n; i++) {
        scanf("%d%d", &t, &f);
        rotateto(&d, t, f);
        printf("%d\n", d.face[2]);
    }
    return 0;
}


Measured memory_bytes: 2052
#include <iostream>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin, (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N;
  int P[200005];
  int cnt = INF;
  int ans = 0;
  cin >> N;
  rep(i, N) {
    cin >> P[i];
    if (P[i] < cnt)
      cnt = P[i];
    else
      ans++;
  }
  cout << N-ans << endl;
}

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

int main(){
  int n;
   cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int b[3];
  b[0]=0,b[1]=0,b[2]=0;
  for(int i=0;i<n;i++){
  if(a[i]%4==0){b[2]++;
               continue;}
    if(a[i]%2==0){b[1]++;
                 continue;}
    b[0]++;
  }
  if(n%2==1){  if(b[2]>=b[0]-1){cout << "Yes" << endl;}else{cout << "No" << endl;}
            return 0;}
  if(b[2]>=b[0]){cout << "Yes" << endl;}else{cout << "No" << endl;
                                            return 0;}
}

Measured memory_bytes: 640
import math
A,B,H,M=map(int,input().split())

s=float(max(6*M,30*H+1/2*M)-min(6*M,30*H+1/2*M))/180*math.pi
S=float(min(s,abs(s-180))/180*math.pi)
print(float(math.sqrt(A**2+B**2-2*A*B*math.cos(s))))

Measured memory_bytes: 9440
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b==c)
    {
      cout<<1<<endl;
    }
 else if(a!=b && b!=c && a!=c)
   {
     cout<<3<<endl;
   }else{
   cout<<2<<endl;
 }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<sstream>
#include<iomanip>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
string s,t;
int ans=1e9,cnt;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s>>t;
	for(int i=0;i<=s.size()-t.size();i++)
	{
		cnt=0;
		forn(j,t.size())if(s[i+j]!=t[j])cnt++;
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 3e5 + 10, p = 998244353;
ll pw(ll a, ll b) {
    ll r = 1;
    for( ; b ; b >>= 1, a = a * a % p) if(b & 1) r = r * a % p;
    return r;
}
ll fac[N], invfac[N], n, a, b, k;
ll C(ll x, ll n) {
    return fac[n] * invfac[x] % p * invfac[n - x] % p;
}
int main() {
    scanf("%lld%lld%lld%lld", &n, &a, &b, &k);
    for(ll i = fac[0] = 1 ; i <= n ; ++ i) fac[i] = fac[i - 1] * i % p;
    for(ll i = 0 ; i <= n ; ++ i) invfac[i] = pw(fac[i], p - 2);
    ll ans = 0;
    for(ll i = 0 ; i <= n ; ++ i) {
        if(k - i * a >= 0 && (k - i * a) % b == 0 && (k - i * a) / b <= n) {
            ans = (ans + C(i, n) * C((k - i * a) / b, n) % p) % p;
        }
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int m,d;
    int p[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    map<int, string> week;
    week[0]="Monday";
    week[1]="Tuesday";
    week[2]="Wednesday";
    week[3]="Thursday";
    week[4]="Friday";
    week[5]="Saturday";
    week[6]="Sunday";
    for (;;){
        scanf("%d %d",&m,&d);
        if (m==0) break;
        int tmp=3;
        if (m>1) {
            for (int i=1;i<m;i++) {
                tmp=(tmp+p[i])%7;
            }
        }
        cout<<week[(tmp+d-1)%7]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3224
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;


namespace AtCoder{

class Program{

static void Main(string[] args){

var answer = "War";

var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
var lineX = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
var lineY = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();


int z = lineY.Min();
foreach(int x in lineX){

if(line[2] >= z){break;}
if(line[3] < z){break;}

if(z > x){
answer = "No War";
}
else{
answer = "War";
break;
}
}

Console.WriteLine(answer);
}

}

}

Measured memory_bytes: 13396
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func getFloat() float64 {
	sc.Scan()
	n, _ := strconv.ParseFloat(sc.Text(), 64)
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	s := getInt()

	var a []int
	m := make(map[int]int, 1)
	var ans int
	a = append(a, s)
	m[s] = 1
	for i := 1; i > 0; i++ {
		if a[i-1]%2 == 0 {
			a = append(a, a[i-1]/2)
			m[a[i]]++
		} else {
			a = append(a, (3*a[i-1])+1)
			m[a[i]]++
		}

		if m[a[i]] == 2 {
			ans = i
			i = -1
		}
	}
	fmt.Println(ans + 1)
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) for(int i = 0; i < (a); ++i)

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;


int getExponent(int arg)
{
	int value = 0;
	
	while (arg % 2 == 0)
	{
		++value;
		arg /= 2;
	}

	return value;
}

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

	int a;
	int ans = INT_MAX;

	REP(i, n)
	{
		cin >> a;
		ans = min(getExponent(a), ans);
	}

	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = 0;

        for(int i=a; i<=b; i++){
            char[] array = String.valueOf(i).toCharArray();
            int count = 0;
            for(int j=0; j<array.length - 2; j++){
                int tail = array.length -1 - j;
                if(array[j] == array[tail]){
                    count++;
                }
            }
            if(count == 3){
                sum++;
            }
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 30928
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int r;
  cin >> r;
  cout << r*r << endl;

  return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    st s ;
    cin >> s ;
    (s[0] == s[2] ? Yes : No) ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,m1,m2;
    scanf("%d",&n);
    m1 = n/100;
    m2 = n%100;
    if(m1>0 && m1<13){
        if(m2>0 && m2<13) printf("AMBIGUOUS");
        else printf("MMYY");
    }
    else{
        if(m2>0 && m2<13) printf("YYMM");
        else printf("NA");
    }
}

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

const int N = (int)1e5 + 5;

long long a,b;

int main(){
	cin >> a >> b;
	long long col = 0ll,i = 2;
	long long g = __gcd(a,b);
   	map<long long,bool> used;
   	for(; i <= sqrt(g); ){
    		if(g % i == 0){
          	g /= i;
            	if(!used[i]) col++;
            	used[i] = 1;
        	}
        	else i++;
    }
    if(g > 1 && !used[g]){
    	col++;	
    }
    cout << col + 1;
    return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        int N;
        string S, T, ans;
        cin >> N >> S >> T;
        rep(i, N)
        {
                cout << S[i] << T[i];
        }

        cout << endl;

        return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n;
	while(cin>>n&&n){
			int a[102]={0},ans=0;
			vector<int>x;
			for(int i=0;i<n+1;i++){
				int tmp;
				cin>>tmp;
				x.push_back(tmp);
				a[i]=tmp;
			}
			
		bool flag=true;
		
			for(int i=0;i<=n;i++){
				flag=true;
				x.erase(x.begin()+i);
					//for(int l=0;l<x.size();l++)cout<<x[l]<<" ";cout<<endl;
					
				int now=x[1]-x[0];
					for(int j=1;j<x.size();j++){
						if(now!=x[j]-x[j-1])flag=false;
					}
				if(flag==true){
					cout<<a[i]<<endl;
					break;
				}
				x.clear();
				for(int i=0;i<n+1;i++){
					x.push_back(a[i]);
				}
			}
		}
	return 0;
}

Measured memory_bytes: 1228
/*

Author : AllKilled
Date   : 201910277

Contest: AtCoder Beginner Contest 144.
Problem: Task D.
Result :

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

typedef long long LL;

const double PI = acos(-1.0);
const LL MAXN = 1e6+7;

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



int main()
{
    double a, b, x, ans;
    scanf("%lf%lf%lf", &a, &b, &x);
    double V = a * a * b;
    if(x == 0){
        ans = 90;
    }
    else if(x * 2 >= V){
        double v = V - x;
        v = v * 2.0 / a / a;
        ans = atan(v/a);
    }
    else {
        double v = x;
        v = v * 2.0 / a / b;
        ans = atan(b/v);
    }
    printf("%.12f\n", ans / PI * 180.0);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

char c[4005];
int a[4005];
int pos[2][2005];
int pl[4005][2005][2];
int dp[2005][2005];

int main(){
	ll n; cin >> n;
	ll N = 2*n;
	rep(i,N) cin >> c[i] >> a[i];
	rep(i,N){
		if(c[i]=='B') pos[0][a[i]] = i;
		else pos[1][a[i]] = i;
	}
	for(ll i=N-1; i>=0; i--){
		rep(j,n+1){
			if(j >= a[i]){
				pl[i][j][0] += pl[i+1][j][0] + (c[i] == 'B');
				pl[i][j][1] += pl[i+1][j][1] + (c[i] == 'W');
			}else{
				rep(k,2) pl[i][j][k] = pl[i+1][j][k];
			}
		}
	}
	auto calc = [&](ll c, ll num, ll id){
		return pos[c][num] - id + pl[pos[c][num]][num-1][c] + pl[pos[c][num]][id+1-num][!c];
	};
	rep(i,n+1) rep(j,n+1) dp[i][j] = inf; 
	dp[0][0] = 0;
	REP(i,1,N+1){
		rep(j,i+1){
			if(j > n || i-j > n) continue;
			if(j>0) chmin(dp[i-j][j], dp[i-j][j-1] + calc(1,j,i-1));
			if(j<i) chmin(dp[i-j][j], dp[i-j-1][j] + calc(0,i-j,i-1));
		}
	}
	cout << dp[n][n] << "\n";
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	string s;
	cin >> s;
	if(s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I')
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
N , K , Q = list(map(int, input().split()))

a = [0] * Q
p = [K] * N

# 行数の入力
for i in range(Q):
    a[i] = int(input())
    p[a[i]-1] = p[a[i]-1] + 1

for j in range(N):
    if p[j] - Q > 0:
        print('Yes')
    else:
        print('No')



Measured memory_bytes: 10432
#include<bits/stdc++.h>
using namespace std;
int a[101][101],num[101],tt[101][2];
bool vis[101];
int n,u,k,x,t=1;
void dfs(int k){
     tt[k][0]=t; t++;
     vis[k]=true;
	 for (int i=1; i<=num[k]; i++){
	     if (!vis[a[k][i]]){
	     	dfs(a[k][i]);
		 }
     }
	 tt[k][1]=t; t++;
}
int main(){
	memset(a,0,sizeof(a));
	memset(vis,false,sizeof(vis));
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>u>>k;
		num[u]=k;
		int j=0;
		while (k--){
			  cin>>x;
			  a[u][++j]=x;
		}
	}
	for (int i=1; i<=n; i++)
	    if (!vis[i])
		   dfs(i); 
	for (int i=1; i<=n; i++){
		cout<<i;
		for (int j=0; j<2; j++)
		    cout<<' '<<tt[i][j];
		cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 3156
s=str(input())
n=len(s)
ans=0
for i in range(n):
    cnt=0
    for j in range(n-i):
        if j!=n-i-1:
            cnt+=(10**j)*(2**(n-j-2))
        else:
            cnt+=(10**j)*(2**i)
    ans+=int(s[i])*cnt
print(ans)
        

Measured memory_bytes: 3068
package main

import "fmt"

func main() {
	var n int
	var a, b, c string
	fmt.Scanf("%d\n%s\n%s\n%s\n", &n, &a, &b, &c)

	count := 0
	var temp string
	var temp2 string
	for i := 0; i < n; i++ {
		temp_count := 0
		temp = string(a[i])
		temp2 = string(b[i])
		if temp == string(b[i]) {
			temp_count++
		}
		if temp == string(c[i]) {
			temp_count++
		}

		if temp_count == 0 && temp2 == string(c[i]) {
			count++
			continue
		}
		if temp_count == 0 {
			count += 2
		} else if temp_count == 1 {
			count++
		} else if temp_count == 0 {
			count++
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 512
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

void recurse(int i, int n, int m, vector<int>& curr, vector<vector<int>>& data, ll& ans) {
    if (n == 0) {
        ll temp = 0;

        for (auto x : data) {
            if ((curr[x[1] - 1] - curr[x[0] - 1]) == x[2])
                temp += x[3];
        }
        ans = max(ans, temp);
        return;
    }

    for (int j = i; j <= m; j++) {
        curr.pb(j);
        recurse(j, n-1, m, curr, data, ans);
        curr.pop_back();
    }
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> data(q, vector<int>(4));
    for (int i = 0; i < q; i++)
        cin >> data[i][0] >> data[i][1] >> data[i][2] >> data[i][3];

    ll ans = 0;
    vector<int> curr;
    recurse(1, n, m, curr, data, ans);
    cout << ans << "\n";
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<pair<int,int>> pp(n,pair<int,int>(0,0));
    rep(i,n){
        cin >> pp[i].first;
        pp[i].second = i+1;
    }
    sort(begin(pp), end(pp));
    rep(i,n){
        cout << pp[i].second;
        cout << (i==n-1 ? "\n" : " ");
    }
    return 0;
}


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

int A, B, C;

int main() {
  cin >> A >> B >> C;

  int x[3][3];
  x[0][0] = A; x[0][1] = B; x[1][1] = C;

  for (int p = 0; ; ++p) {
    x[0][2] = p;
    int S = x[0][0] + x[0][1] + x[0][2];
    x[1][2] = 2 * A + B + C - S;
    x[2][2] = S - A - C;
    x[2][1] = S - B - C;
    x[1][0] = S - C - x[1][2];
    x[2][0] = S - A - x[1][0];

    bool ok = true;
    for (int j = 0; j < 3; ++j) {
      if (x[j][0] + x[j][1] + x[j][2] != S) {
        ok = false; break;
      }
      if (x[0][j] + x[1][j] + x[2][j] != S) {
        ok = false; break;
      }
    }
    if (x[0][0] + x[1][1] + x[2][2] != S) { ok = false; }
    if (x[0][2] + x[1][1] + x[2][0] != S) { ok = false; }
    if (ok) { break; }
  }
  for (int j = 0; j < 3; ++j) {
    for (int k = 0; k < 3; ++k) {
      if (k > 0) { cout << ' '; }
      cout << x[j][k];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Text.Printf
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [h, w] <- getInts
  ; if h == 0 && w == 0 then return ()
    else do
      { let oneline = replicate w '#'
      ; let rect    = replicate h oneline
      ; putStr $ unlines rect
      ; putStrLn ""
      ; loop
      }
  }

--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble x = showFFloat Nothing x ""

getStrings :: IO [String]
getStrings = words <$> getLine 

readInt' :: String -> Int
readInt' = read



Measured memory_bytes: 4316
h, w = map(int,input().split())
a = [list(map(int,input().split())) for i in range(h)]
b = [list(map(int,input().split())) for i in range(h)]

ab = [[0]*w for i in range(h)]
for ch in range(h):
    for cw in range(w):
        ab[ch][cw] = abs(a[ch][cw] - b[ch][cw])

ab0 = ab[0][0]
size = 80*(h+w)
dp = [[0]*w for hh in range(h)]
dp[0][0] |= 2**(size + ab0)
dp[0][0] |= 2**(size - ab0)
for ch in range(h):
    for cw in range(w):
        if ch < h-1:
            dp[ch+1][cw] |= dp[ch][cw] << ab[ch+1][cw]
            dp[ch+1][cw] |= dp[ch][cw] >> ab[ch+1][cw]
        if cw < w-1:
            dp[ch][cw+1] |= dp[ch][cw] << ab[ch][cw+1]
            dp[ch][cw+1] |= dp[ch][cw] >> ab[ch][cw+1]

a = dp[h-1][w-1]>>size
m = a&(-a)
print(m.bit_length()-1)

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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF ((1LL<<62)-1)
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME ((1ll<<61)-1)

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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;
}

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


int N;
string S,T;

void input() {
	cin>>N>>S;
}

bool rec(string t) {
	T=t;
	for(int i=1; i<N-1; i++) {
		if((S[i]=='o') ^ (T[i]=='S') ^ (T[i-1]=='S')) T.pushb('S');
		else T.pushb('W');
	}
	
	if( ((S[N-1]=='o') ^ (T[N-1]=='S') ^ (T[N-2]==T[0])) && ((S[0]=='o') ^ (T[0]=='S') ^ (T[N-1]==T[1])) ) {
		cout<<T<<endl;
		return true;
	}

	return false;
}

void solve() {
	string Tl[]={"SS","SW","WS","WW"};
	for(int i=0; i<4; i++) {
		if(rec(Tl[i])) return;
	}
	cout<<-1<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3748