akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
bool check(vi& a, int t){
    set<int> s = {0};
    for(auto& e : a){
        set<int> ns;
        for(auto& x : s){
            rep(i, 2){
                int dx = (2 * i - 1) * e;
                int nx = x + dx;
                ns.insert(nx);
            }
        }
        s = ns;
    }
    return (s.find(t) != end(s));
}

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

    string in; cin >> in;
    in.push_back('T');
    int x, y; cin >> x >> y;

    vi X, Y;
    char is_x = 1;
    char fst = 1;
    int cnt = 0;
    for(auto& e : in){
        if(e == 'T'){
            fst = 0;
            if(cnt > 0){
                (is_x ? X:Y).emplace_back(cnt);
                cnt = 0;
            }
            is_x ^= 1;
        }
        else {
            if(fst){
                x--;
            }
            else {
                cnt++;
            }
        }
    }

    string res = (check(X, x) and check(Y, y) ? "Yes":"No");
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>
#include <limits>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;

#define FOR( i, m, n )	for( int (i) = (m); (i) < (n); i++ )
#define REP( i, n )		FOR( i, 0, n )
#define ALL( x )	(x).begin(), (x).end()

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

	int count = 0;
	FOR( i, a, b + 1 ) {
		if( c % i == 0 ) count++;
	}

	cout << count << endl;
}


Measured memory_bytes: 3104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.regex.Pattern;

public class Main {
    public void solve(Stdin stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        String s = stdin.next();
        int ans = 0;
        for (int i = 0, len = s.length(); i < len / 2; i++) {
            char c1 = s.charAt(i);
            char c2 = s.charAt(len - i - 1);
            if (c1 != c2) {
                ans++;
            }
        }
        stdout.println(ans);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        Stdin stdin = new Stdin();
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }

    public static class Stdin {
        private Deque<String> queue;
        private BufferedReader stdin;
        private Pattern delimiter;

        public Stdin() {
            queue = new ArrayDeque<>();
            stdin = new BufferedReader(new InputStreamReader(System.in));
            delimiter = Pattern.compile(" ");
        }

        public String next() throws IOException {
            if (queue.isEmpty()) {
                delimiter.splitAsStream(stdin.readLine()).forEach(queue::addLast);
            }
            return queue.removeFirst();
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 26196
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N;
ll mem[3030][3030];
ll a[MAX];

ll rec(ll l, ll r, ll turn) {
    if(l==r) return 0;
    if(mem[l][r]!=-1) return mem[l][r];
    
    ll res=0;
    if(turn==0)
        res=max(rec(l+1, r, 1)+a[l], rec(l, r-1, 1)+a[r-1]);
    if(turn==1)
        res=min(rec(l+1, r, 0)-a[l], rec(l, r-1, 0)-a[r-1]);

    return mem[l][r]=res;
}

int main(void) {
    cin >> N;
    ll i;
    
    for(i=0; i<N; i++) cin >> a[i];
    
    memset(mem, -1, sizeof(mem));
    pt(rec(0, N, 0));
    
}



Measured memory_bytes: 72192
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int n=s.size();
  string ans="No";
  for(int i=0;i<n;i++){
    bool b=true;
    for(int j=0;j<n;j++){
      if(s.at(j)!=t.at((j+i)%n)){b=false;}
    }
    if(b){ans="Yes"; break;}
  }
  cout<<ans;
}
      

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#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[6] = {1, 0, -1, 0,1,-1};
const int dy[6] = {0, 1, 0, -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);
    int N,M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    queue<int> que;
    vector<int> dist(N,-1);
    dist[0] = 0;
    que.push(0);
    while(que.size()){
        int v = que.front();que.pop();
        for(int nv:G[v]){
            if(dist[nv] != -1) continue;
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
    if(dist[N-1] == 2){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 13168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main(){
	int n, m;
	cin >> n >> m;
	int dp[m+1][1<<n];
	repn(i,m)rep(j,1<<n) dp[i][j] = INF;
	int a[m];
	vector<int> b[m];
	rep(i,m){
		int q;
		cin >> a[i] >> q;
		rep(j,q){
			int r;
			cin >> r;
			r--;
			b[i].push_back(r);
		}
	}

	dp[0][0] = 0;
	rep(i,m){
		for(int bit = 0; bit < (1 << n); bit++){
			chmin(dp[i+1][bit], dp[i][bit]);
			int nowbit = bit;
			for(auto e : b[i]){
				nowbit = nowbit | 1 << e;
			}
			chmin(dp[i+1][nowbit], dp[i][bit]+a[i]);
		}
	}
	if(dp[m][(1<<n)-1]==INF) cout << -1 << endl;
	else cout << dp[m][(1<<n)-1] << endl;
}

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

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

const ll mod =  1000000007;  //ansを出力する時は (ans % mod + mod) % mod とする(負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int main()
{
    int n; cin >> n;
    ll ans = 1;
    for(int i = 1; i <= n; i++){
        ans *= i;
        ans %= mod;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
        int a,b;
        scanf("%d",&a);
        scanf("%d",&b);
        if(a>b) {
                printf("a > b\n");
        }else if(a<b){
                printf("a < b\n");
        }else{
                printf("a == b\n");
        }return 0;
}

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

#define ll long long
#define inf 100000000000

vector<vector<ll>>dp;

ll frog(vector<vector<ll>> &a,ll n,ll i,ll prev)
{
    if(i==n)
        return 0;
    
    if(dp[i][prev]!=-1)
    {
        return dp[i][prev];
    }


    ll a1=-1,b1=-1,c1=-1;
    if(prev!=1)
    {
        a1=a[i][1]+frog(a,n,i+1,1);
    }
    if(prev!=2)
    {
        b1=a[i][2]+frog(a,n,i+1,2);
    }
    if(prev!=3)
    {
        c1=a[i][3]+frog(a,n,i+1,3);
    }
    dp[i][prev]=max(a1,max(b1,c1));
    return dp[i][prev];
    
    
}




int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    ll n;
    cin>>n;
    vector<vector<ll>> a(n,vector<ll>(10));
    dp.resize(n+10,vector<ll>(11,-1));
  //  std::vector<ll> v(n+1,0) ;
    for(ll i=0;i<n;i++){
        
        cin>>a[i][1]>>a[i][2]>>a[i][3]; 
    }
    cout<<frog(a,n,0,0)<<endl;
    
	return 0;
}

Measured memory_bytes: 31488
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char c[110000];
int n;
int sa_k;
int Rank[110000];
int tmp[110000];
int sa[110000];
int lcp[110000];
bool compare_sa(int i,int j){
	if(Rank[i]!=Rank[j])return Rank[i]<Rank[j];
	else{
		int ri=i+sa_k<=n?Rank[i+sa_k]:-1;
		int rj=j+sa_k<=n?Rank[j+sa_k]:-1;
		return ri<rj;
	}
}
void construct_sa(){
	for(int i=0;i<=n;i++){
		sa[i]=i;
		Rank[i]=i<n?c[i]:-1;
	}
	for(sa_k=1;sa_k<=n;sa_k*=2){
		sort(sa,sa+n+1,compare_sa);
		tmp[sa[0]]=0;
		for(int i=1;i<=n;i++){
			tmp[sa[i]]=tmp[sa[i-1]]+(compare_sa(sa[i-1],sa[i])?1:0);
		}
		for(int i=0;i<=n;i++){
			Rank[i]=tmp[i];
		}
	}
}

void construct_lcp(){
	for(int i=0;i<=n;i++)Rank[sa[i]]=i;
	int h=0;
	lcp[0]=0;
	for(int i=0;i<n;i++){
		int j=sa[Rank[i]-1];
		if(h>0)h--;
		for(;j+h<n&&i+h<n;h++){
			if(c[j+h]!=c[i+h])break;
		}
		lcp[Rank[i]-1]=h;
	}
}
int hd[110000];
int main(){
	scanf("%s",c);
	n=strlen(c);
	construct_sa();
	construct_lcp();
	int ret=0;
	for(int i=0;i<n;i++)hd[lcp[i]]++;
	int cnt=0;
	for(int i=n;i>0;i--){
		cnt++;
		cnt-=hd[i];
		ret=max(ret,cnt);
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n;
    cin >> n;
    vector<int> foo(501);
    foo[0] = -1;
    for(int i = 1; i <= 500; ++i){
        foo[i] = i * (i - 1) / 2;
    }
    int k = lower_bound(foo.begin(), foo.end(), n) - foo.begin();
    if(n != foo[k]){
        cout << "No\n";
        return 0;
    }

    vector<P> st(n);
    int cur = 0;
    for(int i = 0; i < k - 1; ++i){
        for(int j = i + 1; j < k; ++j){
            st[cur++] = P(i, j);
        }
    }

    vector<vector<int>> ans(k);
    for(int i = 0; i < n; ++i){
        int x = st[i].first, y = st[i].second;
        ans[x].push_back(i + 1);
        ans[y].push_back(i + 1);
    }
    
    cout << "Yes\n" << k << '\n';
    for(int i = 0; i < k; ++i){
        cout << k - 1 << ' ';
        for(int j = 0; j < k - 1; ++j){
            cout << ans[i][j];
            cout << ((j == k - 2) ? '\n' : ' ');
        }
    }
}

Measured memory_bytes: 3072
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

s = input()
n = len(s)
dp = [[0]*13 for _ in range(n+1)]
dp[0][0] = 1
M = 10**9+7
for i in range(n):
    c = s[i]
    if c !="?":
        c = int(c)
    for j in range(13):
        if c=="?":
            for k in range(10):
                dp[i+1][(10*j+k)%13] += dp[i][j]
        else:
            dp[i+1][(10*j+c)%13] += dp[i][j]
    for j in range(13):
        dp[i+1][j] %= M
print(dp[n][5])

Measured memory_bytes: 61788
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

#define debug(x) (cout << # x ": " << x << endl)
#define int long long int
#define repeat(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()

signed main() {
    int a, b;
    cin >> a >> b;

    repeat(i, 2000) {
        if (i * 8 / 100 == a && i / 10 == b) {
            cout << i;
            return 0;
        }
    }

    cout << -1;
    return 0;
}


Measured memory_bytes: 3092
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    if (c >= a && c <= b) {
        println("Yes")
    } else {
        println("No")
    }
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 31396
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
ll gcd(ll x, ll y)
{
    return y == 0?x:gcd(y, x%y);
}
int main()
{
    ll x, y;
    cin >> x >> y;
    if(x == y || gcd(x, y) == y)
    {
        cout << -1 << endl;
        return 0;
    }
    ll ji = 1;
    while(1)
    {
        if((x*ji)%y != 0)
        {
            cout << x*ji << endl;
            break;
        }
        ji++;
    }
    return 0;
}
/*
                 ___====-_  _-====___
           _--^^^#####//      \\#####^^^--_
        _-^##########// (    ) \\##########^-_
       -############//  |\^^/|  \\############-
     _/############//   (@::@)   \\############\_
    /#############((     \\//     ))#############\
   -###############\\    (oo)    //###############-
  -#################\\  / VV \  //#################-
 -###################\\/      \//###################-
_#/|##########/\######(   /\   )######/\##########|\#_
|/ |#/\#/\#/\/  \#/\##\  |  |  /##/\#/  \/\#/\#/\#| \|
`  |/  V  V  `   V  \#\| |  | |/#/  V   '  V  V  \|  '
   `   `  `      `   / | |  | | \   '      '  '   '
                    (  | |  | |  )
                   __\ | |  | | /__
                  (vvv(VVV)(VVV)vvv)
                  ÁúÉñ±£ÓÓ ÓÀÎÞbug
*/


Measured memory_bytes: 256
/* SANDEEP YADAv*/
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
lld gcd(lld a,lld b){ if(a<b) { a=a+b; b=a-b; a=a-b;}while(b!=0){lld r=a%b; a=b; b=r;} return a;}
long long power(long long a, long long b, long long m) {a %= m;long long res = 1;while (b > 0) {if (b & 1)res = res * a % m;a = a * a % m;b >>= 1;}return res;}
void judge()
{
      #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
}

int main()
{
    fastio;
    //judge();
    
    lld n;
    cin>>n;

    lld ans=1;
    lld a[n];
    lld maxi=1e18;
    for(int i=0;i<n;i++)
    {
      cin>>a[i];
      if(a[i]==0)
      {
        cout<<0;
        return 0;
      }
    }
    lld flag=0;
    for(int i=0;i<n-1;i++)
    {
      ans=ans*a[i];
      if((double)a[i+1]>(double)maxi/ans)
      {
        flag=1;
        break;
      }
      
    }
    if(flag)
      cout<<"-1";
    else
      {
        if(ans*a[n-1]>maxi)
          cout<<"-1";
        else
          cout<<ans*a[n-1];
      }
    return 0;
}

Measured memory_bytes: 4436
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			Vector2 r1 = new Vector2(sc.nextDouble(), sc.nextDouble());
			Vector2 r2 = new Vector2(sc.nextDouble(), sc.nextDouble());
			Vector2 r3 = new Vector2(sc.nextDouble(), sc.nextDouble());
			Vector2 rp = new Vector2(sc.nextDouble(), sc.nextDouble());
			if (r2.subtract(r1).cross(r3.subtract(r2)) < 0) {
				Vector2 temp = r2;
				r2 = r3;
				r3 = temp;
			}
			boolean ans = true;
			ans &= Vector2.dist(r1, r2, rp) > 0;
			ans &= Vector2.dist(r2, r3, rp) > 0;
			ans &= Vector2.dist(r3, r1, rp) > 0;
			System.out.println(ans ? "YES" : "NO");
		}
	}

}
class Vector2 {
	public double x;
	public double y;
	public Vector2(double x,double y) {
		this.x = x;
		this.y = y;
	}
	public double dot(Vector2 v) {
		return this.x*v.x+this.y*v.y;
	}
	public double cross(Vector2 v) {
		return this.x*v.y-this.y*v.x;
	}
	public double norm() {
		return Math.sqrt(this.x*this.x+this.y*this.y);
	}
	public Vector2 normalize() {
		return divide(norm());
	}
	public Vector2 add(Vector2 v) {
		return new Vector2(x+v.x,y+v.y);
	}
	public Vector2 subtract(Vector2 v) {
		return new Vector2(x-v.x,y-v.y);
	}
	public Vector2 multiply(double k) {
		return new Vector2(x*k,y*k);
	}
	public Vector2 divide(double k) {
		return new Vector2(x/k,y/k);
	}
	public Vector2 rotate90() {
		return new Vector2(-y,x);
	}
	public Vector2 rotate270() {
		return new Vector2(y,-x);
	}
	public static double dist(Vector2 r1,Vector2 r2,Vector2 p) {
		return r2.subtract(r1).normalize().cross(p.subtract(r1));
	}
	public String toString() {
		return "(" + this.x + "," + this.y + ")";
	}
}

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


int main() {
	long long n;

	int keta = 0;
	long long x = 0;
	cin >> n;

	while (x < n) {
		keta++;
		if (keta >= 16)break;
		x += pow(26, keta);
	}

	int c[100] = { 0 };
	long long nanban;
	if (keta != 16) nanban = n - (x - pow(26, keta));
	else  nanban = n - x;
	int i = 0;

	//if (nanban == 0) {
	//	for (int i = keta - 1; i >= 0; i--) {
	//		printf("%c", 'z');
	//	}
	//	return 0;
	//}
	//while (1) {
	//	int  amari = nanban % 26;
	//	//cout << nanban << endl;
	//	 nanban = nanban / 26;
	//	
	//	c[i] = amari;
	//	i++;
	//	if (nanban <26)break;
	//}
	//c[i] = nanban;
	//bool ok = true;
	//for (int i = keta - 1; i >= 0; i--) {
	//	if (c[i] != 0)ok = false;

	//}
	//if (ok) {
	//	for (int i = keta - 1; i >= 0; i--) {
	//		printf("%c", 'z');

	//	}
	//	return 0;
	//}

	//for (int i = keta - 1; i >= 0; i--) {
	//	if (i != 0) {
	//		printf("%c", 'a' + c[i]);
	//		//cout << c[i] << endl;
	//	}

	//	if (i == 0) {
	//		if (c[i] == 0) {
	//			printf("z");
	//		}
	//		else {
	//			printf("%c", 'a' + c[i] - 1) ;
	//		}
	//	}
	//}
	string ans;
	nanban--;
	for (int i = 0; i < keta; i++) {
		ans += 'a' + nanban % 26;
		nanban /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans;
	cout << endl;
	return 0;



}

//string f(long long n) {
//	if (n == 0)return "";
//	n--;
//
//	return f(n / 26) + string(1,'a' + n % 26);
//
//}
//int main() {
//	long long n;
//	cin >> n;
//	cout << f(n) << endl;
//
//	return 0;
//}

//int main() {
//	long long n;
//	cin >> n;
//	string ans;
//	while (n) {
//		n--;
//		ans += 'a' + n % 26;
//		n /= 26;
//	
//	}
//	reverse(ans.begin(), ans.end());
//	cout << ans << endl;
//	return 0;
//}

Measured memory_bytes: 4040
{
  const Main = input => {
    input = input.split("\n")
    let [h, w] = input[0].split(" ").map(v => parseInt(v))
    w -= 1

    const list = []
    for (let i = 1; i <= h; i++) {
      list.push(input[i].split('').map(v => {
        return v === '#' ? '#' : 0
      }))
    }

    list.forEach((raw, rawI) => {
      raw.forEach((v, i) => {
        if (v === '#') {
          if (rawI > 0) {
            // 1つ前
            if (i > 0 && list[rawI - 1][i - 1] !== '#') {
              list[rawI - 1][i - 1]++;
            }
            if (list[rawI - 1][i] !== '#') {
              list[rawI - 1][i]++
            }
            if (i < w && list[rawI - 1][i + 1] !== '#') {
              list[rawI - 1][i + 1]++
            }
          }

          // 同じだん
          if (i > 0 && list[rawI][i - 1] !== '#') {
            list[rawI][i - 1]++
          }
          if (i < w && list[rawI][i + 1] !== '#') {
            list[rawI][i + 1]++
          }

          // // したのだん
          if (rawI < h - 1) {
            // 1つ前
            if (i > 0 && list[rawI + 1][i - 1] !== '#') {
              list[rawI + 1][i - 1]++
            }
            if (list[rawI + 1][i] !== '#') {
              list[rawI + 1][i]++
            }
            // 1つ次
            if (i < w && list[rawI + 1][i + 1] !== '#') {
              list[rawI + 1][i + 1]++
            }
          }
        }
      })
    })
    console.log(list.map(raw => raw.join("")).join("\n"))
  };
  
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


Measured memory_bytes: 32672
H, W, K = map(int, input().split())
A = [input() for _ in range(H)]

ans = 0
for row in range(1 << H):
    R = set([i for i in range(H) if (row & (1 << i)) != 0])
    for col in range(1 << W):
        C = set([i for i in range(W) if (col & (1 << i)) != 0])

        cnt = 0
        for h in range(H):
            for w in range(W):
                if A[h][w] == '.' or h in R or w in C:
                    continue
                cnt += 1

        if cnt == K:
            ans += 1

print(ans)


Measured memory_bytes: 9164
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<string, int> P;
typedef vector<vector<int>> Graph;

const double PI = 3.14159265358979323846;
const int mod = 1000000007;



int main(int argc, char *args[]) {
	double L; cin >> L;
	double a = L / 3;
	double ans = a * a * a;
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<string>
//#include<string>
//#include<sstream>
using namespace std;
int main()
{
	long long a[2],k;
	scanf("%lld%lld%d",&a[0],&a[1],&k);
	int i;
	for(i=0;i<k;i++)
	{
		if(i%2==0)
		{
			if(a[0]%2==0)
			{
				a[1]+=(a[0]/2);
				a[0]=a[0]/2;
			}
			else
			{
				a[0]--;
				a[1]+=(a[0]/2);
				a[0]=a[0]/2;
			}
		}
		else
		{
			if(a[1]%2==0)
			{
				a[0]+=(a[1]/2);
				a[1]=a[1]/2;
			}
			else
			{
				a[1]--;
				a[0]+=(a[1]/2);
				a[1]=a[1]/2;
			}
		}
	}
	printf("%lld %lld\n",a[0],a[1]);
}

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

int main(){

  int N, M, Q, counter, L, R;
  cin >> N >> M >> Q;
  int p[Q], q[Q];
  int train[N][N], c[N][N];  //train[Li][Ri]
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      train[i][j] = 0;
      c[i][j] = 0;
    }
  }

  /*累積和*/
  for(int i = 0; i < M; i++){
    cin >> L >> R;
    train[L-1][R-1]++;
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(j == 0)
        c[i][j] = train[i][j];
      else
        c[i][j] = c[i][j-1] + train[i][j];
    }
  }
  /*累積和ここまで*/

  for(int i = 0; i < Q; i++){
    cin >> p[i] >> q[i];
  }

  for(int i = 0; i < Q; i++){
    counter = 0;
    for(int j = p[i] - 1; j < q[i]; j++){
      if(p[i] - 2 >= 0)
        counter += (c[j][q[i] - 1] - c[j][p[i] - 2]);
      else
        counter += c[j][q[i] - 1];
      //cout << j << " " << q[i] - 1 << " " << p[i]-1 << endl;
    }
    cout << counter << endl;
  }
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll
const int N = 1<<18;

int n, res, c;

VPII G[N];
int x[N];
int p[N];
int dist[N];
int pre[N];
int post[N];
PII e[N];

int Find(int a)
{
	if(p[a]!=a)
		p[a] = Find(p[a]);

	return p[a];
}

bool Union(int a, int b)
{
	a = Find(a);
	b = Find(b);

	if(a!=b)
	{
		p[a] = b;
		return 1;
	}

	return 0;
}

struct tree
{
	PII sub[2*N][2];
	int load[2*N];

	PII query(int z)
	{
		if(sub[1][0].nd==z)
			return sub[1][1];
		else
			return sub[1][0];
	}

	inline void merge(int v)
	{
		int u = 2*v;
		int w = 2*v+1;

		if(sub[u][0]>sub[w][0])
			swap(u, w);

		sub[v][0] = sub[u][0];
		sub[v][1] = sub[u][1];

		if(sub[w][0].nd!=sub[v][0].nd)
			sub[v][1] = min(sub[v][1], sub[w][0]);
		
		if(sub[w][1].nd!=sub[v][0].nd)
			sub[v][1] = min(sub[v][1], sub[w][1]);

		sub[v][0].st += load[v];
		sub[v][1].st += load[v];
	}

	inline void insert(int a, int b, int c, int v = 1, int l = 0, int r = N-1)
	{
		if(a>r || l>b)
			return;

		if(a<=l && r<=b)
		{
			load[v] += c;
			sub[v][0].st += c;
			sub[v][1].st += c;
			return;
 		}

 		insert(a, b, c, v<<1, l, (l+r)>>1);
 		insert(a, b, c, (v<<1)+1, ((l+r)>>1)+1, r);
 		merge(v);
	}

	void build()
	{
		for(int i = 0; i < 2*N; ++i)
		{
			for(int j = 0; j < 2; ++j)
			{
				sub[i][j] = mp(INF, INF);
			}

			load[i] = 0;
		}

		for(int i = 1; i <= n; ++i)
		{
			sub[pre[i]+N][0] = min(sub[pre[i]+N][0], mp(dist[i]+x[i], Find(i)));
		}

		for(int i = N-1; i >= 1; --i)
		{
			merge(i);
		}
	}
};

tree T;

void dfs(int v)
{
	pre[v] = ++c;

	for(auto it:G[v])
	{
		if(!pre[it.st])
		{
			dist[it.st] = dist[v]+it.nd;
			dfs(it.st);
		}
	}

	post[v] = c;
}

int all = 0;

void solve(int v)
{
	auto q = T.query(Find(v));
	q.st += x[v];
	q.st += all;
	e[Find(v)] = min(e[Find(v)], q);

	for(auto it:G[v])
	{
		if(pre[it.st]>pre[v])
		{
			all += it.nd;
			T.insert(pre[it.st], post[it.st], -2*it.nd);
			solve(it.st);
			all += -it.nd;
			T.insert(pre[it.st], post[it.st], 2*it.nd);
		}
	}
}

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> n;

	for(int i = 1; i <= n; ++i)
	{
		cin >> x[i];
	}

	for(int i = 1; i < n; ++i)
	{
		int a, b, c;
		cin >> a >> b >> c;
		G[a].eb(b, c);
		G[b].eb(a, c);
	}

	for(int i = 1; i <= n; ++i)
	{
		p[i] = i;
	}

	dfs(1);

	int comp = n;

	while(comp>1)
	{
		T.build();

		for(int i = 1; i <= n; ++i)
		{
			e[i] = mp(INF, INF);
		}

		solve(1);

		for(int i = 1; i <= n; ++i)
		{
			if(i==Find(i) && e[i]!=mp(INF, INF) && Union(i, e[i].nd))
			{
				--comp;
				res += e[i].st;
			}
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 76800
#include<bits/stdc++.h>
using namespace std;
char s[110];
int ans;
int main()
{
	cin>>s;
	int n=strlen(s);
	for(int i=0;i<=(n-1)/2;i++)
	{
		if(s[i]!=s[n-i-1]) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

	int main()
	{
		/*#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
		#endif*/
		cin>>a>>p;
		cout<<(a*3+p)/2;
		return 0;
	}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long[] aa = sc.LongArray();

        long answer = 0;
        long before = aa[0];

        for (int i = 1; i < n; i++)
        {
            long current = aa[i];
            if (current < before)
            {
                answer += before - current;
                current = before;
            }
            before = current;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 47360
//#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int k, s, x, y, cnt=0;
	scanf("%d %d", &k, &s);
	for (x = 0; x <= k; x++) {
		for (y = 0; y <= k; y++) {
			if (x + y <= s && x + y >= s - k)
				cnt++;
		}
	}
	printf("%d", cnt);
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>

using namespace std;

class Dice
{
public:
	Dice() {};
	Dice(int s1, int s2, int s3, int s4, int s5, int s6)
	{
		Upper = s1;
		South = s2;
		East = s3;
		West = s4;
		North = s5;
		Down = s6;
	};
	Dice(int *v)
	{
		Upper = v[0];
		South = v[1];
		East = v[2];
		West = v[3];
		North = v[4];
		Down = v[5];
	};
	~Dice() {};
public:
	int Upper, Down;
	int South, North;
	int East, West;
public:
	void RolltoNorth();
	void RolltoSouth();
	void RolltoEast();
	void RolltoWest();
	void RollalongCW();
	void RollalongUCW();

public:
	void Disp() 
	{
		cout <<"U: " << this->Upper << " "
			<< "S: " << this->South << " "
			<< "E: " << this->East << " "
			<< "W: " << this->West << " "
			<< "N: " << this->North << " "
			<< "D: " << this->Down << endl;
	};
	void DispUpper()
	{
		cout << this->Upper << endl;
	};
};

void Dice::RolltoNorth()
{
	Dice a;
	a.Down = this->North;
	a.North = this->Upper;
	a.Upper = this->South;
	a.South = this->Down;
	a.East = this->East;
	a.West = this->West;
	*this = a;
}
void Dice::RolltoSouth()
{
	Dice a;
	a.Down = this->South;
	a.South = this->Upper;
	a.Upper = this->North;
	a.North = this->Down;
	a.East = this->East;
	a.West = this->West;
	*this = a;
}

void Dice::RolltoEast()
{
	Dice a;
	a.Down = this->East;
	a.East = this->Upper;
	a.Upper = this->West;
	a.West = this->Down;
	a.South = this->South;
	a.North = this->North;
	*this = a;
}

void Dice::RolltoWest()
{
	Dice a;
	a.Down = this->West;
	a.West = this->Upper;
	a.Upper = this->East;
	a.East = this->Down;
	a.South = this->South;
	a.North = this->North;
	*this = a;
}

void Dice::RollalongCW()
{
	Dice a;
	a.East = this->North;
	a.North = this->West;
	a.West = this->South;
	a.South = this->East;
	a.Upper = this->Upper;
	a.Down = this->Down;
	*this = a;
}

void Dice::RollalongUCW()
{
	Dice a;
	a.West = this->North;
	a.North = this->East;
	a.East = this->South;
	a.South = this->West;
	a.Upper = this->Upper;
	a.Down = this->Down;
	*this = a;
}


int main()
{
	
	int v[6];
	for (int i = 0; i < 6; ++i)
		cin >> v[i];
	Dice minion(v);
	string order;
	cin >> order;

	for (int i = 0; i < order.size(); ++i)
	{
		switch (order[i])
		{
		case 'S':
			minion.RolltoSouth();
			break;
		case 'N':
			minion.RolltoNorth();
			break;
		case 'E':
			minion.RolltoEast();
			break;
		case 'W':
			minion.RolltoWest();
			break;
		default:
			cout << "ERROR" << endl;
			return 0;
		}
	}

	minion.DispUpper();

	return 0;
}




Measured memory_bytes: 3240
import numpy as np
x1,y1,x2,y2=map(int,input().split(" "))

v1=np.array([x1,y1])
v2=np.array([x2,y2])

Rr=np.array([[0,1],
             [-1,0]])
Rl=np.array([[0,-1],
             [1,0]])

v4=np.dot(Rl,(v2-v1))+v1
v3=v4+(v2-v1)

print("{} {} {} {}".format(v3[0],v3[1],v4[0],v4[1]))

Measured memory_bytes: 21524
#include<bits/stdc++.h>
using namespace std;
int n[200010];
int main()
{
    int h,a;
    cin>>h>>a;
    if(h<a)
    {
    	cout<<'0';
    	return 0;
	}
    for(int i=0;i<h;i++)
    {
    	cin>>n[i];
	}
	sort(n,n+h);
	long long sum=0;
	for(int i=h-a-1;i>=0;i--)
	{
		sum+=n[i];
	}
	cout<<sum;
	return 0;
}

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

using namespace std;
using ll = long long;

int main(void) {
	int w, h, n;
	scanf("%d %d %d", &w, &h, &n);
	int down = 0, up = h, left = 0, right = w;
	for (int i = 0; i < n; i++) {
		int x, y, a;
		scanf("%d %d %d", &x, &y, &a);
		if (a == 1) left = max(left, x);					
		else if (a == 2) right = min(right, x);
		else if (a == 3) down = max(down, y);
		else if (a == 4) up = min(up, y);
	}
	if (left >= right || up <= down)
		puts("0");
	else 
		printf("%d\n", (right - left) * (up - down));
	return 0;
}

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

int main(){
  int m=0,n,x=0;
  cin >> n;
  char s[n];
  for(int i=0;i<n;i++){
    cin >> s[i];
    if(s[i]=='I'){x++;}
    else{x--;}
    if(m<=x){m=x;}
  }
  cout << m << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX_n 200000
int max(int,int);
int min(int,int);
int main(void){
    int R[MAX_n],n,i;
    scanf("%d",&n);
    for (i=0;i<n; i++)
        scanf("%d",&R[i]);
        int maxv=-2000000000;
        int minv=R[0];
        for(int i=1;i<n;i++){
            maxv=max(maxv,R[i]-minv);
            minv=min(minv,R[i]);
    }
    printf("%d\n",maxv);
    return 0;
}
int max(int a,int b){
    return a>b ? a: b;
}
int min(int a,int b){
    return a<b ? a: b;
}


Measured memory_bytes: 2624
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

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

  int max = 1;
  for(int i = 1;i<s.size()/2;i++){
    string tmp1,tmp2;
    tmp1 = s.substr(0,i);
    tmp2 = s.substr(i,i);

    if(tmp1 == tmp2)
      max = i;

  }

  cout<<max*2<<endl;
    
    

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		String S = in.next();
		String T = in.next();
		for (int i = 0; i < N; i++) {
			System.out.print(S.charAt(i));
			System.out.print(T.charAt(i));
		}
		System.out.println();
		in.close();
	}
}

Measured memory_bytes: 22612
#include <algorithm>
#include <cfloat>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min({ a + b,b + c,c + a }) << endl;
	return 0;
}

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

int main(){
    /*
    i1 i2 i3 i4 ... iN
    7 5
    7 7 7 7 7
    6 2
    6 6
    */
    ios::sync_with_stdio(0); cin.tie(0);
    
    ll N, K; cin >> N >> K;
    ll Area[100005]; fill_n(Area, 100005, 0);
    for(int i = 1; i <= N; i++){
        int a, b; cin >> a >> b;
        Area[a] += b;
    }
    
    ll Ans = 0;
    for(int i = 1; K > 0; i++){
        Ans = i;
        K -= Area[i];
    }
    
    cout << Ans;
}


Measured memory_bytes: 1024
#include <cstdio>
 
int main(){
  int a[4],b[4];
  while(~scanf("%d %d %d %d\n%d %d %d %d\n",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])){
    int c=0,d=0;
    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++)
    if(a[i]==b[j])
      i==j?c++:d++;
    printf("%d %d\n",c,d);
  }
}

Measured memory_bytes: 1028
program main
implicit none
integer i,m,n,p,sumwa
integer,allocatable :: ac(:),wa(:)
character(2) s
read(*,*) n,m

allocate(ac(n))
allocate(wa(n))
ac(:)=0;wa(:)=0
sumwa=0

do i=1,m
   read(*,*) p,s
   if(ac(p)==0 .and. s=='AC') then
         ac(p)=1
         sumwa =sumwa + wa(p)
   else if(ac(p)==0 .and. s=='WA') then
         wa(p)=wa(p) + 1
   endif
end do
      
write(*,'(i0,a,i0)') sum(ac),' ',sumwa
end program main




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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

inline ll exp(ll x, ll n, ll m = MOD) {
    ll r = 1;
    while(n) {
        if(n & 1) r = r * x % m;
        x = x * x % m, n >>= 1;
    }
    return r;
}

const int N=1e5+5;
int n,m;
vi adj[N];
ll dp[N],dp1[N];

void dfs(int u,int p){
	dp[u]=1;
	for(auto v: adj[u]){
		if(v!=p){
			dfs(v,u);
			dp[u]=(dp[u]*(1LL+dp[v]))%m;
		}
	}
}

void dfs2(int u,int p){
	dp[u]=(dp[u]*(dp1[u]+1LL))%m;
	ll t=1;
	fr(i,0,adj[u].size()){
		if(adj[u][i]!=p){
			dp1[adj[u][i]]=t;
			t=((dp[adj[u][i]]+1LL)*t)%m;
		}
	}
	t=1;
	fri(i,adj[u].size()-1,0){
		if(adj[u][i]!=p){
			dp1[adj[u][i]]=(dp1[adj[u][i]]*t)%m;
			t=(t*(dp[adj[u][i]]+1LL))%m;
			dp1[adj[u][i]]=(dp1[adj[u][i]]*(dp1[u]+1LL))%m;
		}
	}
	for(auto v: adj[u]){
		if(v!=p){
			dfs2(v,u);
		}
	}
}

void solve(){
	cin>>n>>m;
	int u,v;
	fr(i,0,n-1){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	fr(i,2,N)
	dp1[i]=1;
	dfs(1,0);
	dfs2(1,0);
	fr(i,1,n+1){
		cout<<dp[i]<<endl;
	}
	return;
}

int main()
{
	boost();
	
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 16152
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[2][100005]; // DP[0][x]:x桁目(ぴったり), DP[1][x]:x桁目(未満)

int main() {
    string L;
    cin>>L;
    DP[0][0] = 2;
    DP[1][0] = 1;
    for(int i=1;i<L.size();++i){
        if(L[i]=='1'){
            DP[0][i] = DP[0][i-1]*2%mod;
            DP[1][i] = (DP[0][i-1] + DP[1][i-1]*3)%mod;
        }
        else{
            DP[0][i] = DP[0][i-1];
            DP[1][i] = DP[1][i-1]*3%mod;
        }
    }
    cout<<(DP[0][L.size()-1]+DP[1][L.size()-1])%mod<<endl;
}



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

#define   ipr         	pair<int, int>
#define   pb            push_back
#define   ff            first
#define   ss            second
#define   fr(i, j, k)   for (int i = j; i < k; i++)
#define   rf(i, j, k)   for (int i = j; i >= k;i--)
#define   int           long long
#define   ll 			unsigned long long
#define   ld            long double
#define   all(x)        x.begin(), x.end()
#define   rall(x)       x.rbegin(),x.rend()
#define   mp            make_pair
#define   inf           INT_MAX
#define   read_file();	freopen("input.txt", "r", stdin);	freopen("output.txt", "w", stdout);
#define   IOS           std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int Maxn  =  10000;
const ld  pi   =  acos(-1);
const int mod =  1000000007;


template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template<class T> ostream& operator <<(ostream &out,set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}

bool palindrome(string t){
   int flag=0;
   int f=t.length();
   fr(i,0,f/2){
   if(t[i]!=t[f-i-1]){
      flag=1;
      
      break;
   }
}
if(flag==0)return true;
else if(flag==1)return false;
}


int32_t main(){IOS
double n;
cin>>n;
double x=n/3.0;
double y=x*x*x;
cout << setprecision(12) << y <<endl;



}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
void read(bool A[51][51]) {
    REP (i, N) REP (j, N) A[i][j] = false;
    REP (i, N-1) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--; y--;
	A[x][y] = 1;
	A[y][x] = 1;
    }
}
bool A[51][51];
bool B[51][51];
bool W[51][51];
bool use[51];


void MAIN() {
    scanf("%d", &N);
    read(A);
    read(B);

    bool same = true;
    REP (i, N) REP (j, N) if (A[i][j] != B[i][j]) {
	same = false;
    }

    int ans = -1;
    if (same) {
	ans = 0;
    } else {
	VI ord;

	REP (s, N) if (count(A[s], A[s]+N, true) == 1) {
	    REP (t, N) if (s != t) {
		memset(use, 0, sizeof use);
		REP (i, N) REP (j, N) W[i][j] = A[i][j];

		REP (i, N) W[i][s] = W[s][i] = false;
		W[s][t] = W[t][s] = true;
		use[s] = true;
		ord.clear();
		ord.push_back(s);

		for (int i=0; i<(int)ord.size(); i++) {
		    int v = ord[i];
		    REP (j, N) if (!use[j] && B[v][j] && W[v][j]) {
			use[j] = true;
			ord.push_back(j);
		    }
		}

		while (1) {
		    bool update = false;
		    REP (j, N) if (!use[j] && count(W[j], W[j]+N, true) == 1) {
			REP (k, N) if (use[k] && B[j][k]) {
			    use[j] = true;
			    REP (l, N) W[j][l] = W[l][j] = false;
			    W[j][k] = W[k][j] = true;
			    update = true;
			}
		    }
		    if (!update) break;
		}

		if (count(use, use+N, true) == N) {
		    int tmp = N+1 - (int)ord.size();
		    if (ans == -1 || ans > tmp) ans = tmp;
		}
	    }
	}
    }

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

int main() {
    int TC = 1;
    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
import Data.Array.IO
import Control.Monad

main = do
  (h:w:_) <- getLine >>= return . (map read) . words :: IO [Int]
  ms <- newArray ((0, 0), (w+1, h+1)) 0 :: IO (IOArray (Int, Int) Int)

  forM_ [1..h] $ \y -> do
    ln <- getLine
    forM_ [1..w] $ \x -> do
      when (ln!!(x-1) == '#') (writeArray ms (x,y) 1)

  let dir = [(1,0), (1,1), (0,1), (-1,1), (-1,0), (-1,-1), (0,-1), (1,-1)]
  forM [1..h] $ \y -> do
    t <- forM [1..w] $ \x -> do
      r <- readArray ms (x, y)
      s <- forM [0..7] $ \k -> do
        let (dx,dy) = dir!!k
        c <- readArray ms (x+dx, y+dy)
        return c
      return $ if r==1 then "#" else (show (sum s))
    putStrLn (concat t)
          


Measured memory_bytes: 1020
#include <iostream>
#include <cmath>
#include <vector>

int c_rec(int m, int r, long l, std::vector<std::vector<std::vector<int>>> v){
    int tmp = 0;
    if(m == 1){
        l += r;
        std::vector<int> a;
        a.push_back(1);
        for(int i = 0; i < 10; ++ i){
            for(int j = 0; j < l % 10; ++ j) a.push_back(i + 1);
            l /= 10;
            if(l == 0) break;
        }
        for(int i = 0; i < a.size() - 1; ++ i) for(int j = i; j < a.size(); ++ j) tmp += v[i][j][a[j] - a[i]];
    }else for(int i = 0; i <= r; ++ i) tmp = std::fmax(tmp, c_rec(m - 1, r - i, l + pow(10, m - 1) * i, v));

    return tmp;
}

int main(void){
    int n, m, q;
    std::cin >> n >> m >> q;
    std::vector<std::vector<std::vector<int>>> v(n - 1, std::vector<std::vector<int>>(n, std::vector<int>(m, 0)));
    for(int i = 0; i < q; ++ i){
        int a, b, c, d;
        std::cin >> a >> b >> c >> d;
        v[a - 1][b - 1][c] = d;
    }
    std::cout << c_rec(m, n - 1, 0, v) << std::endl;

    return 0;
}


Measured memory_bytes: 4148