akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll n, dp[210000], s[210000], f[210000];
bool ok = false;
int main(){
	cin >> n;
	REP(i, 210000)f[i] = -1;
	dp[0] = 1;
	REPO(i, n) cin >> s[i];
	REPO(i, n) {		
		dp[i] += dp[i - 1];
		if (f[s[i]] != -1) ok = true;
		if (f[s[i]] != -1 and f[s[i]] != i - 1) {
			dp[i] += dp[f[s[i]]];
		}
		dp[i] %= MOD;
		f[s[i]] = i;
	}
	//REPO(i, n)cout << dp[i] << " " << i << endl;
	if (!ok)cout << 1 << endl;
	else cout << dp[n] % MOD << endl;
}



Measured memory_bytes: 5120
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		String a=sc.next();
		String b=sc.next();
		String ans;
		int la=a.length();
		int lb=b.length();
		
		if(la>lb) {
			ans="GREATER";
		}
		else if(la<lb) {
			ans="LESS";
		}
		else {
			if(a.compareTo(b)<0){
				ans="LESS";
			}
			else if(a.compareTo(b)>0) {
				ans="GREATER";
			}
			else {
				ans="EQUAL";
			}
			
		}
		System.out.println(ans);
	}
	
	
	
//----------------------------------------------------------
	static int l_min(int[] a) {
		Arrays.sort(a);
		return a[0];
	}
	static int l_max(int[] a) {
		int l=a.length;
		Arrays.sort(a);
		return a[l-1];
	}
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}





Measured memory_bytes: 23124
#include"bits/stdc++.h"
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ld           long double
#define vi           vector<int>
#define pii          pair<int,int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,y,sizeof(x))
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
#define int          long long
const int INF = 0x3F3F3F3F3F3F3F3F;
const int MOD = 1e9+7;
ld EPS = 1e-12;


short rain()
{
    // ifstream fin("ip.txt"); ofstream fout("op.txt");
    // int t;cin>>t;rep(test,1,t)
    {
        string s, t;
        cin >> s >> t;
        t.pop_back();
        if( s==t )
            cout << "Yes\n";
        else
            cout << "No\n";
    }

    return 0;
}

signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int start = 1000*clock()/CLOCKS_PER_SEC;
    cout << fixed << setprecision(15);           rain();
    cerr << 1000*clock()/CLOCKS_PER_SEC-start << "ms\n";
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;

void solve(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  V2<int> t(n,V<int>(26,0));
  FOR(i,0,n){
    string s; cin >> s;
    FOR(j,0,10) ++t[i][s[j]-'a'];
  }
  sort(ALL(t));
  ll ans = 0;
  int l=0, r=l+1;
  for(;l<n && r<n;){
    while(t[l]==t[r]){
      ++r;
      if(r==n) break;
    }
    ans += (ll)(r-l)*(r-l-1)/2;
    l = r;
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 13696
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
	string s, mode, longest;
	typedef map<string, int> dic_t;
	dic_t dic;
	while (cin >> s) {
		if (++ dic[s] > dic[mode])
			mode = s;
		if (s.size() > longest.size())
			longest = s;
	}
	cout << mode << ' ' << longest << endl;
	return 0;
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
  string s;
  cin >> s;
  reverse(ALL(s));
  cout << s << endl;
}

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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0);

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int n; cin >> n;
  vector<vector<char>> s(n);
  char tmp;
  REP(i, n) {
    s[i].resize(n);
    REP(j, n) {
      cin >> s[i][j];
    }
  }

  bool sym = true;
  int count = 0;

  REP(k, n) {

    REP(i, n) {
      FOR(j, i+1, n) {
        if(s[(i+k)%n][j] != s[(j+k)%n][i]) {
          sym = false;
          break;
        }
      }
      if(!sym) break;
    }
    
    if(sym) {
      count += n;
    }

    sym = true;
  }

  cout << count << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(long long A, long long B, long long C, long long K){
  ll ans = 0;
  if(K < A){
    cout << K << endl;
    return;
  }
  if(K >= A){
    K -= A;
    ans += A;
  }
  if(K >= B){
    K -= B;
  }
  if(K >= C){
    K -= C;
    ans -= C;
  }else{
    ans -= K;
  }
  cout << ans << endl;
}

int main(){
    long long A;
	scanf("%lld",&A);
	long long B;
	scanf("%lld",&B);
	long long C;
	scanf("%lld",&C);
	long long K;
	scanf("%lld",&K);
    solve(A, B, C, K);
}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	map<int,int> mp;
	for(int i=0;i<n;i++){
		cin >> a[i];
		mp[a[i]]++;
	}
	sort(a.begin(),a.end());
	bool ok=1;
	if(a[n-1]%2){
		if(a[0]<(a[n-1]+1)/2)ok=0;
		if(mp[(a[n-1]+1)/2]!=2)ok=0;
		for(int j=(a[n-1]+1)/2;j<=a[n-1];j++){
			if(mp[j]<2)ok=0;
		}
	}else{
		if(a[0]<a[n-1]/2)ok=0;
		if(mp[a[n-1]/2]!=1)ok=0;
		for(int j=(a[n-1]+1)/2+1;j<=a[n-1];j++){
			if(mp[j]<2)ok=0;
		}
	}
	if(ok){
		cout << "Possible" << endl;
	}else{
		cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 256
from math import gcd

k = int(input())
total = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        t = gcd(a, b)
        for c in range(1, k+1):
            # print(a, b, c, gcd(a, gcd(b, c)))
            total += gcd(t, c)
print(total) # sample_02 1982 ms


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int dp[501][10001];

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

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

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

    int m, n;
    cin >> m >> n;

    vector<int> p(m);
    rep(i, m){
        cin >> p[i];
    }
    SORT_INV(p);

    vector<int> sum(m + 1);
    REP(i, 1, m + 1){
        sum[i] = sum[i - 1] + p[i - 1];
    }

    vector<int> c(n), e(n);
    rep(i, n){
        cin >> c[i] >> e[i];
    }

    fill(dp[0], dp[n + 1], IINF);
    dp[0][0] = 0;

    REP(i, 1, n + 1){
        rep(j, m + 1){
            chmin(dp[i][j], dp[i - 1][j]);
            chmin(dp[i][j], dp[i - 1][max(j - c[i - 1], 0)] + e[i - 1]);
        }
    }

    int ans = 0;
    rep(i, m + 1){
        chmax(ans, sum[i] - dp[n][i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 22856
// Problem : A - Coffee
// Contest : AtCoder - AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
const int N = 1e6 + 1;

int n = 0;
char s[N];

void baka() {
	while (true) {
		s[++n] = getchar();
		if (s[n] == '\n') {
			n--;
			break;
		}
	}
	if (s[3] == s[4] && s[5] == s[6]) {
		cout << "Yes";
	} else {
		cout << "No";
	}
}

int main() { cin.tie(0)->sync_with_stdio(0);
	int t = 1;
	// cin >> t;
	while (t--) {
		baka();
	}
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int MAXN=805;
const int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}};

int H,W,K;
char maze[MAXN][MAXN];

int step[MAXN][MAXN];
pair<int,int> st;
queue<pair<int,int> > Q;

int main()
{
    scanf("%d%d%d",&H,&W,&K);
    for(int i=1;i<=H;i++)
    {
        scanf("%s",maze[i]+1);
        for(int j=1;j<=W;j++)
            if(maze[i][j]=='S')
                st.first=i,st.second=j;
    }

    memset(step,-1,sizeof step);
    step[st.first][st.second]=0;
    Q.push(st);
    int ans=0x3F3F3F3F;
    while(!Q.empty())
    {
        pair<int,int> u=Q.front();
        Q.pop();

        ans=min(ans,(u.first-1+K-1)/K+1);
        ans=min(ans,(u.second-1+K-1)/K+1);
        ans=min(ans,(H-u.first+K-1)/K+1);
        ans=min(ans,(W-u.second+K-1)/K+1);

        if(step[u.first][u.second]>=K)
            continue;

        for(int d=0;d<4;d++)
        {
            pair<int,int> v=u;
            v.first+=dir[d][0],v.second+=dir[d][1];
            if(step[v.first][v.second]==-1&&maze[v.first][v.second]!='#')
            {
                step[v.first][v.second]=step[u.first][u.second]+1;
                Q.push(v);
            }
        }
    }

    printf("%d\n",ans);

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++)  cin >> A.at(i);

  vector<long long> sum(N+1,0);
  for(int i=0;i<N;i++)  sum.at(i+1)=sum.at(i)+A.at(i);
  long long ans=1e18;
  for(int i=1;i<N;i++){
    long long tmp=abs((sum.at(N)-sum.at(i))-sum.at(i));
    ans=min(ans,tmp);
  }
  cout << ans << endl;

  return 0;
}


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

const int MOD = 1000000007;
#define p(var)  std::cout<<var<<std::endl
#define pp(var) std::cout<<#var" = "<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for (int i = 0; i <  (n); i++)
#define repeq(i, n) for (int i = 1; i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
using ll = long long;
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a;}
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b;}

/*-----8<-----8<-----*/

// Standard partition process of QuickSort(). 
// It considers the last element as pivot 
// and moves all smaller element to left of 
// it and greater elements to right 
template<typename T>
int partition(vector<T> &arr, int l, int r) 
{ 
    T x = arr[r];
    int i = l; 
    for (int j = l; j <= r - 1; j++) { 
        if (arr[j] > x) {//if (arr[j] < x) { // if (arr[j] > x) { //降順にしたい時
            swap(arr[i], arr[j]); 
            i++; 
        } 
    } 
    swap(arr[i], arr[r]); 
    return i; 
} 
  
// This function returns k'th smallest  
// element in arr[l..r] using QuickSort  
// based method.  ASSUMPTION: ALL ELEMENTS 
// IN ARR[] ARE DISTINCT 
template<typename T>
T qselect(vector<T> &arr, int l, int r, int k) 
{ 
    // If k is smaller than number of  
    // elements in array 
    if (k > 0 && k <= r - l + 1) { 
  
        // Partition the array around last  
        // element and get position of pivot  
        // element in sorted array 
        int index = partition(arr, l, r); 
  
        // If position is same as k 
        if (index - l == k - 1) 
            return arr[index]; 
  
        // If position is more, recur  
        // for left subarray 
        if (index - l > k - 1)  
            return qselect(arr, l, index - 1, k); 
  
        // Else recur for right subarray 
        return qselect(arr, index + 1, r,  
                            k - index + l - 1); 
    } 
  
    // If k is more than number of  
    // elements in array 
    return INT_MAX; 
} 
  
// Driver program to test above methods 
int main() 
{ 
    int X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vector<ll> a(X,0),b(Y,0),c(Z,0);
    rep(i,X)
        cin >> a[i];
    rep(i,Y)
        cin >> b[i];
    rep(i,Z)
        cin >> c[i];

    sort(all(a),greater<ll>());
    sort(all(b),greater<ll>());
    sort(all(c),greater<ll>());

    vector<ll> v;
    rep(i,X){
      rep(j,Y){
        rep(k,Z){
          if((i+1)*(j+1)*(k+1)>K)break;
          ll tmp=a[i]+b[j]+c[k];
          //pp(tmp);
          v.pb(tmp);
        }
      }
    }

    ll border = qselect(v, 0, v.size()-1, K);

    vector<ll> vv;
    int count=0;
    int i=0;
    while(count<K){
      if(border<=v[i]){
        count++;
        vv.pb(v[i]);
      }
      i++;
    }

    sort(all(vv),greater<ll>());
    rep(i,K)
      p(vv[i]);
    
    return 0; 
} 





Measured memory_bytes: 1532
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	k := getNextInt(scanner)
	x := getNextInt(scanner)

	ans := "No"
	if k*500 >= x {
		ans = "Yes"
	}
	fmt.Fprintln(writer, ans)
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ld W, H; cin >> W >> H;
    ld x, y; cin >> x >> y;
    if(x == W / 2 && y == H / 2) {
        cout << fixed << setprecision(3) << W * H / 2 << " " << 1 << endl;
        return 0;
    }
    cout << fixed << setprecision(3) << W * H / 2 << " " << 0 << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int64_t i=0;i<(int64_t)N;i++)
const int INF=0x7f7f7f7f;
int main()
{
  int N,M,X,check,cost,pay=INF;
  vector<int> C(12,0),up(12,0);
  vector<vector<int>> A(12,vector<int>(12,0));
  cin>>N>>M>>X;
  rep(i,N){cin>>C.at(i);rep(j,M)cin>>A.at(i).at(j);}
  rep(i,(1<<N))
  {
    cost=0;rep(k,M)up.at(k)=0;
    rep(j,N)
    {
      if((i>>j)%2)
      {
        cost+=C.at(j);check=1;
        rep(k,M){up.at(k)+=A.at(j).at(k);check&=((up.at(k)<X)?0:1);}
        if(check)pay=(cost<pay)?cost:pay;
      }
    }
  }
  return printf("%d\n",(pay==INF)?-1:pay),0;
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int, int>
#define pll pair<ll, ll>
#define N 200123
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vpll vector<pll>
#define pb emplace_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define oo 100000012
#define mod 1000000007LL
#define M 10000123

using namespace std;

int f(int a, int b){
    return a*2 + b*4;
}

int main(){
    ios_base::sync_with_stdio(0);

    int n, p;
    cin >> n >> p;

    int ok = 0;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n; ++j){
            if(i+j == n && f(i, j) == p){
                ok = 1;
                j = n + 1;
                i = n + 1;
            }
        }
    }
    if(ok) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3660
/**
 * @author sakt_coder
 * created on 2020-09-19 17:41
 */
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws Exception
	{
		int n=nextInt();
		long ans=0;
		for(int a=1;a<=n;a++)
			for(int b=1;a*b<n;b++)
				ans++;
		out.println(ans);
				
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws Exception
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws Exception{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws Exception{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws Exception{
		return br.readLine();
	}
	int nextInt()throws Exception{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception{
		return Double.parseDouble(nextToken());
	}
}


Measured memory_bytes: 32964
#include <stdio.h>
int main(){
    int x,y,temp;
    
    while(1){
        scanf("%d %d",&x,&y);
        if (x==0 && y==0) break;
        
        if(x>y){
        temp=x;
        x=y;
        y=temp;
        }
        printf("%d %d\n",x,y);
    }
    return 0;
}


Measured memory_bytes: 2000
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string a, b, c;
  cin >> a >> b >> c;
  if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
return 0;
}


Measured memory_bytes: 256
w, h, x, y, r = [int(i) for i in input().split()] # 5 4 2 2 1
if x - r >= 0 and x + r <= w:
    if y - r >= 0 and y + r <= h:
        print("Yes")
    else:
        print("No")
else:
    print("No")



Measured memory_bytes: 5604
#include<bits/stdc++.h>
typedef long long ll;
#define F(i,L,R) for (ll i = L; i < R; i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define re(x) scanf("%lld",&x)
using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin>>s;
  if(s[0]==s[1] && s[1] == s[2] && s[0] == 'R') cout<<3;
  else if((s[0]==s[1] && s[0] == 'R') || (s[1]==s[2] && s[1] == 'R')) cout<<2;
  else if(s[1]=='R'||s[0]=='R'||s[2]=='R') cout<<1;
  else cout<<0;
  
  return 0;
}

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

int main() {
  int X, N;
  cin >> X >> N;
  
  if (N == 0){
    cout << X;
    return 0;
  }
  
  vector<int>p(N);
  for (int i=0; i<N;i++)
    cin >> p.at(i);
  
  sort(p.begin(),p.end());
  int x = 0;
  
  for (;x<N;x++){
    if(p.at(x) == X)
      break;
  }
  
  if (x == N){
    cout << X;
    return 0;
  }
  
  for (int i=1;i<=N/2;i++){
    if (x-i<0){
      cout << X-i;
      return 0;
    }
    if (p.at(x-i) == X-i){
      if (x+i>=N){
        cout << X+i;
        return 0;
      }
      if (p.at(x+i) == X+i){
        continue;
      } else {
        cout << X+i;
        return 0;
      }
    } else {
      cout << X-i;
      return 0;
    }
  }
  cout << p.at(0) - 1;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define f first
#define s second
#define fore(i, b, e)    for (int i = (int)b; i < (int)e; i++)
#define forr(i, b, e)    for (int i = (int)b; i < (int)e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
const double EPS = 1e-9;
const double PI = acos(-1);
#define tam 3341

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    ll num,valor;
    cin>>num;
    valor=ll(num/500LL)*1000LL+ll((num%500)/5LL)*5;
    cout<<valor<<endl;
}
// PLUS ULTRA!


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int k[2020],f[2000005],a[2000005],g[2000005];
int sum;
int mian(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();++i)
		a[i+1]=s[i]-'0';
	int l=1;
	for(int i=s.size();i>=0;--i){
		g[i]=l;
		l*=10;
		l%=2019;
	}
	for(int i=s.size();i>=1;--i){
		f[i]=(f[i+1]+a[i]*g[i])%2019;
		++k[f[i]];
	}
	sum=k[0];
	for(int i=0;i<=2018;++i)
		sum+=k[i]*(k[i]-1)/2;
	cout<<sum<<endl;
	return 0;
}
signed main(){
	int t=1;
//	cin>>t;
	while(t--)
		mian();
	return 0;
}


Measured memory_bytes: 8420
#include    <iostream>
#include    <stack>
#include    <deque>
#include    <string>
#include    <utility>

using namespace std;

int main() {
    using uint = unsigned int;

    string in;
    stack<uint> downPoint;              // 下り坂の地点を覚える
    deque<pair<uint, uint> > puddles;   // 水たまりの始点位置と面積の組 stackとqueueを使いたいため，dequeで実装
    uint sum = 0;

    // 入力
    cin >> in;

    // 計算
    for(uint i = 0; i < in.size(); i++) {
        if(in[i] == '\\') {
            downPoint.push(i);
        }
        // のぼり坂の場合，総面積の更新と水たまりの更新(結合)を行う．
        // ただし，対応する下り坂がない場合はこの計算を行わない．
        else if(in[i] == '/' && !downPoint.empty()) {
            // 対応する坂との間の部分面積を求める．
            uint j = downPoint.top(), p = i - j;
            downPoint.pop();
            // 総面積に加算する．
            sum += p;

            // 水たまりをまとめる．
            while(!puddles.empty() && puddles.front().first > j) {
                p += puddles.front().second;
                puddles.pop_front();
            }
            puddles.push_front(make_pair(j, p));
        }
    }

    // 出力
    cout << sum << endl;
    cout << puddles.size();
    while(!puddles.empty()) {
        cout << ' ' << puddles.back().second;
        puddles.pop_back();
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3268
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Solver().solve(new Scanner(System.in));
//        new Solver().solve(new Scanner(ex));
    }

    private static final String ex = "3";
}

class Solver {
    Solver() {}

    void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.nextLine());

        System.out.println(N * (N + 1) / 2);
    }
}


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

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

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
    int n,a;
    scanf("%d%d",&n,&a);
    printf("%d\n",n*n-a);
    return 0;
}


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

int main(){

int n,m;
  cin >> n >> m;
  int wacount = 0;
  int account = 0;
  
vector<int> veca(m);
  vector<string> vecb(m);
  vector<int> vecc(n,0);
  for(int i =0; i<m; i++){
   cin >>veca.at(i);
    cin >> vecb.at(i);
    if(vecb.at(i)=="AC"){
     vecc.at(veca[i]-1) = 3; 
    }
  }
  // 0未着手　1間違えてる　2正解した　3未来に正解するよ
  for(int i=0; i<m; i++){
  
    if(vecb.at(i)=="AC"&& vecc.at( veca.at(i)-1 ) !=2){
      account ++;
    vecc.at(veca.at(i)-1)=2;  
    }else if(vecb.at(i)=="AC"&& vecc.at( veca.at(i)-1 ) ==2){
     
      
    }else
        if(vecb.at(i)=="WA" && vecc.at( veca.at(i)-1 )==3 ){
  		//vecc.at(veca.at(i)-1)=1;
         wacount++;
        }
  }
  cout << account << " " << wacount;
}

Measured memory_bytes: 6528
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = map(str, readline().decode('utf-8').strip().split())
    if A[-1]==B[0] and B[-1]==C[0]:
        print('YES')
    else:
        print('NO')



if __name__ == '__main__':
    main()


Measured memory_bytes: 9100
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = in.nextInt();
        Arrays.sort(a);
        long ans = 0;
        for (int i = 0; i < n - k; i++) ans += a[i];
        System.out.println(ans);

    }
}


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

int main() {
  int n;
  cin >> n;
  bool b[100010];
  rep(i,100010) b[i] = false;
  for (int i = 1; i <= 9; i++) b[i] = true;
  for (int i = 100; i <= 999; i++) b[i] = true;
  for (int i = 10000; i <= 99999; i++) b[i] = true;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (b[i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
/*
 * Created by KeigoOgawa
 */


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <cmath>

#define INF (int)1e8
#define EPS 1e-10
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)
#define debug(x) cout << #x << ": " << x << endl
#define all(a) (a).begin(), (a).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;

const int MOD = 1e9 + 7;
const int MAX_P = 200000;

// n! mod p のテーブル O(p)
ll fact[MAX_P];

void init_fact() {
    fact[0] = 1;
    FOR(i, 1, MAX_P) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
}

// ax + by = gcd(a, b)を返す
// x, yは整数解になっている
ll extgcd(ll a, ll b, ll &x, ll &y) {
    ll d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

// ax ≡ 1(mod m) となるxを返す
ll mod_inverse(ll a, ll m) {
    ll x, y;
    // x, yがax + my = 1 の解になっている
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

// n! = a*p^e としたときの a mod p, e を求める. O(log_p n)
// e = (n!の中にあるpの数) => n!からpを取り出した残りがa, つまり,
// a = (pで割り切れないものの積) * (pで割り切れるものをpで割った商)
// よって, (n! mod p) = (a mod p) となる
ll mod_fact(ll n, ll p, ll &e) {
    e = 0;
    if (n == 0) {
        return 1;
    }

    // pの倍数の部分を計算
    ll res = mod_fact(n / p, p, e);
    e += n / p;

    // (p-1)! ≡ -1 より (p-1)!^(n/p)は n/p の偶奇だけで計算できる
    if (n / p % 2 != 0) {
        return res * (p - fact[n % p] % p);
    }
    return res * fact[n % p] % p;
}

ll mod_comb(ll n, ll k, ll p) {
    if (n < 0 || k < 0 || n < k) {
        return 0;
    }
    ll e1, e2, e3;
    ll a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);

    if (e1 > e2 + e3) {
        return 0;
    }
    return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

int H, W, A, B;

void solve() {
  ll ans = 0;
  REP(i, H - A - 1) {
    ll a = mod_comb(B - 1 + i, i, MOD) % MOD;
    ll b = mod_comb(H - i - 1 + (W - B - 1), W - B - 1, MOD) % MOD;
    ans += (a * b) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  init_fact();
  cin >> H >> W >> A >> B;
  A--;

  solve();
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;



int main()
{
    double a,b,c;
    int d=0,e=0,f=0;
    while(~scanf("%lf,%lf,%lf",&a,&b,&c)&&f<=50)
    {
        f++;
        if(a==b)
        {
            d++;
            if(a*a+b*b==c*c)
            {
                e++;
            }
        }
        else
        {
            if(a*a+b*b==c*c)
            {
                e++;
            }
        }
    }
    printf("%d\n%d\n",e,d);
    return 0;
}



Measured memory_bytes: 3108
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	M, D := nextInt(), nextInt()
	ans := 0
	if M < 4 || D < 22 {
		fmt.Println(0)
		return
	}
	for i := 4; i <= M; i++ {
		for j := 22; j <= D; j++ {
			d1 := j % 10
			d10 := (j / 10) % 10
			if d1 >= 2 && d10 >= 2 && i == d1*d10 {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.math.BigInteger;
 
public class Main implements Runnable {
	
	static int mod = 1000000007;
	
    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 1024 * 1024 * 1024).start();
    }
    
    public void run() {
       	PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        
        int n = sc.nextInt();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long[] x = sc.nextlongArray(n);
        
        long ans = 0;
        
        for(int i=0;i<n-1;i++){
        	long walk = (x[i+1] - x[i])*a;
        	ans += Math.min(walk, b);
        }
        
        out.println(ans);
        out.flush();
    }
    
}


class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public int[] nextintArray(int n){
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public long[] nextlongArray(int n){
		long[] a = new long[n];
		for(int i=0;i<n;i++){
			a[i] = nextLong();
		}
		return a;
	}
	public Integer[] nextIntegerArray(int n){
		Integer[] a = new Integer[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public int[][] nextintMatrix(int h, int w){
		int[][] mat = new int[h][w];
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				mat[i][j] = nextInt();
			}
		}
		return mat;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 24148
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const int T=86400;

int main(){
  int n;
  while(cin>>n){
    if(n==0) return 0;
    
    vector<int> A(T+1);
    int h,m,s;
    char c;
    rep(i,n){
      cin>>h>>c>>m>>c>>s;
      A[3600*h+60*m+s]++;
      cin>>h>>c>>m>>c>>s;
      A[3600*h+60*m+s]--;
    }   
    
    for(int i=1;i<=T;i++){
     A[i]+=A[i-1];
    }
    
    int max=0;
    rep(i,T){
      if(max<A[i]) max=A[i];
    }    
    cout<<max<<endl;    
  }
  
  return 0;
}


Measured memory_bytes: 3424
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

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

    int left = 0;
    int right = n - 1;
    int ans = 0;
    while(left < right) {
        if (c[left] == 'R' && c[right] == 'W') {
            left++;
            right--;
        } else if (c[left] == 'R' && c[right] == 'R') {
            left++;
        } else if (c[left] == 'W' && c[right] == 'W') {
            right--;
        } else {
            ans++;
            left++;
            right--;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3716
import           Control.Applicative
import           Control.Monad
import           Data.Array.IO
import           Data.Array.MArray
import           Data.List           (intercalate, sort, splitAt)

kugiri :: String
kugiri = "####################"

createArray :: [[Int]] -> IO (IOUArray (Int, Int, Int) Int)
createArray xss = do
    a <- newArray ((1,1,1), (4,3,10)) 0
    forM_ xss $ \[b,f,r,v] -> do
        n <- readArray a (b,f,r)
        writeArray a (b,f,r) (n + v)
    return a

showArray :: IOUArray (Int, Int, Int) Int -> IO ()
showArray a = do
    es <- getElems a
    let (b1, ss) = splitAt 30 es
    let (b2, ts) = splitAt 30 ss
    let (b3, us) = splitAt 30 ts
    let (b4, _ ) = splitAt 30 us
    showBuilding b1
    putStrLn kugiri
    showBuilding b2
    putStrLn kugiri
    showBuilding b3
    putStrLn kugiri
    showBuilding b4

showBuilding :: [Int] -> IO ()
showBuilding es = do
    let (f1, ss) = splitAt 10 es
    let (f2, ts) = splitAt 10 ss
    let (f3, _ ) = splitAt 10 ts
    putStrLn . (' ':) . intercalate " " $ map show f1
    putStrLn . (' ':) . intercalate " " $ map show f2
    putStrLn . (' ':) . intercalate " " $ map show f3
    return ()

main :: IO ()
main = do
    getLine
    xss <- fmap (fmap read . words) . lines <$> getContents :: IO [[Int]]
    a <- createArray (sort xss)
    showArray a



Measured memory_bytes: 4324
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;

 int main()
 {
   int c1,c2,c3;
   while(cin>>c1>>c2>>c3)
   {
     bool arr[10]={false};
     int sum=c1+c2;
     arr[c1-1]=true;
     arr[c2-1]=true;
     arr[c3-1]=true;
     int count=0;
     int count2=0;
     for(int i=0;i<10;i++)
     {
       if((!arr[i])&&((sum+i+1)<=20)) 
       {
         count++;                              
       }    
     }
     double rate=1.0*count*6/42;
     if(rate>0.5) cout<<"YES"<<endl;
     else cout<<"NO"<<endl;
   }
   //while(1);
   return 0;
 }

 

Measured memory_bytes: 3048
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <chrono>
using namespace std;

int main(int argc, const char * argv[]) {
    
    int N;
    cin >> N;
    
    int pow2 = 1;
    
    while (pow2 <= N) {
        pow2 *= 2;
    }
    
    cout << pow2 / 2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    if(a*b==15){
        cout << "*" << endl;
    }else if(a+b==15){
        cout << "+" << endl;
    }else{
        cout << "x" << endl;
    }
}







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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;
	cin >> S;

	if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3])
	{
		cout << "Bad" << endl;
	}
	else
	{
		cout << "Good" << 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); 
		
		while (true) {
  			 String str = sc.next();
 			 if (str.equals("-"))	break;
			 int h = sc.nextInt();
			 int[] a = new int[h];
			 for (int i = 0; i < a.length; i++) {
				a[i] = sc.nextInt();
			 }

			for (int i = 0; i < a.length; i++) {
				str = str.substring(a[i])+str.substring(0,a[i]);
			 }
			System.out.println(str);
		}

		sc.close();
	}

}


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

int main() {
  int N,wa,n;
  cin >> N;
  wa = 0;
  n = N;
  
    
  for(int i=0;i<2000000000;i++){
    wa += n%10;
    n /= 10;
    if(n==0)break;
  }
  
  
  
  if(N%wa==0){
    cout << "Yes" <<endl;
  }
  
  else {
    cout <<"No" <<endl;
  }
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll N, Q;
    cin >> N >> Q;

    set<ll> tate, yoko;
    tate.insert(0);
    yoko.insert(0);

    vector<int> whent(N), wheny(N);
    ll res = 0;

    rep(i, Q) {
        int q;
        cin >> q;
        ll x;
        cin >> x;
        if(q == 1) {
            auto it = tate.lower_bound(N - x);
            int sub = 0;
            if(it != tate.end())
                sub = whent[*it];
            else
                sub = *yoko.rbegin();
            res += N - 2 - sub;
            whent[N - x] = sub;
            tate.insert(N - x);
        } else {
            auto it = yoko.lower_bound(N - x);
            int sub = 0;
            if(it != yoko.end())
                sub = wheny[*it];
            else
                sub = *tate.rbegin();
            res += N - 2 - sub;
            wheny[N - x] = sub;
            yoko.insert(N - x);
        }
    }
    cout << (N - 2) * (N - 2) - res << endl;
}

Measured memory_bytes: 14356
var
	n,i,ans,now,sum,p:Longint;
	x:array[1..100]of Longint;
begin
	read(n);
	sum:=0;
	for i:=1 to n do begin
		read(x[i]);
		inc(sum,x[i]);
	end;
	ans:=100000000;
	for p:=sum div n-3 to sum div n+3 do begin
		now:=0;
		for i:=1 to n do inc(now,(x[i]-p)*(x[i]-p));
		if now<ans then ans:=now;
	end;
	writeln(ans);
end.


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

int main(){
	int N,M;
	string blue[100];
	cin>>N;
	for(int i=0;i<N;++i) cin>>blue[i];
	string red[100];
	cin>>M;
	for(int i=0;i<M;++i) cin>>red[i];
	map<string,int> ans;
	for(int i=0;i<N;++i){
		if (ans.count(blue[i])==0) ans.insert(make_pair(blue[i],1));
		else ans[blue[i]]++;
	}
	for(int i=0;i<M;++i){
		if (ans.count(red[i])==0) ans.insert(make_pair(red[i],-1));
		else ans[red[i]]--;
	}
	int num=0;
	for (int i=0;i<N;++i){
		if(num<ans[blue[i]]) num=ans[blue[i]];
	}
	cout<<num<<endl;
}


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

int main() {
int64_t k,a,ans;
  a=7;
  ans=1;
  cin>>k;
  if(k%2==0||k%5==0){cout<<-1<<endl;}
  else if(k==1||k==7){cout<<1<<endl;}
  else{
  while(a!=0){
    ans++;
  a=(a*10+7)%k;
  }
     cout<<ans<<endl;
  }
 
}

Measured memory_bytes: 3632