akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    char s[1000];
    int yes=0;
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=1;s[i]!='\0';i++){
        if(s[i-1]=='A'&&s[i]=='B'&&s[i+1]=='C'){yes++;}
    }
    printf("%d\n",yes);
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int A = scan.nextInt();
        int B = scan.nextInt();
        String s = scan.next();
        char[] x = s.toCharArray();
        boolean answer = true;
        for (int i = 0; i < A; i++) {
            if (!(0 <= x[i] - '0' && x[i] - '0' <= 9)) {
                answer = false;
                break;
            }
        }
        if (x[A] != '-') {
            answer = false;
        }
        for (int i = 0; i < B; i++) {
            if (!(0 <= x[A+1+i] - '0' && x[A+1+i]-'0' <= 9)) {
                answer = false;
                break;
            }
        }
        System.out.println(answer ? "Yes" : "No");
    }
}


Measured memory_bytes: 23764
program next_prime
  implicit none
  integer :: x, i, j
  logical :: p(100003) = .false.
  read(*,*) x
  p(1) = .true.
  do i = 1, x-1
    if (p(i)) cycle
    do j = i, 100003, i
      p(j) = .true.
    end do
  end do
  do i = x, 100003
    if (p(i)) cycle
    write(*,'(i0)') i
    stop
  end do
end program next_prime

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N=1000;
int lcs(string X,string Y){
    int c[N+1][N+1];
    int m=X.size();
    int n=Y.size();
    int maxl=0;
    X=' '+X;
    Y=' '+Y;
    for(int i=0;i<=m;i++)c[i][0]=0;
    for(int i=1;i<=n;i++)c[0][i]=0;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(X[i]==Y[j]) c[i][j]=c[i-1][j-1]+1;
            else c[i][j]=max(c[i-1][j],c[i][j-1]);
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}
int main(){
    string s1,s2;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s1>>s2;
        cout<<lcs(s1,s2)<<"\n";
    }
    return 0;
}


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

using namespace std;

struct edge
{
	int v,nxt;
}e[4050];

int ecnt,head[2050];

void adde(int u,int v)
{
	e[++ ecnt].v = v;
	e[ecnt].nxt = head[u];
	head[u] = ecnt;
}

int sz[2050],lft[2050],dist[2050];
char str[2050];
int n;

void dfs(int pos,int lst)
{
	sz[pos] = str[pos] == '1' ? 1 : 0;
	dist[pos] = 0;
	int maxn = 0;
	for(int i = head[pos];i;i = e[i].nxt)
	{
		int v = e[i].v;
		if(v != lst)
		{
			dfs(v,pos);
			sz[pos] += sz[v];
			dist[pos] += dist[v] + sz[v];
			lft[v] += sz[v];
			if(lft[v] > lft[maxn]) maxn = v;
		}
	}
	if(!maxn) lft[pos] = 0;
	else
	{
		int tot = dist[pos] - dist[maxn] - sz[maxn];
		if(tot >= lft[maxn]) lft[pos] = dist[pos] & 1;
		else lft[pos] = lft[maxn] - tot;
	}
}

int main()
{
	scanf("%d %s",&n,str + 1);
	for(int i = 1;i < n; ++ i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		adde(u,v),adde(v,u);
	}
	lft[0] = -0x3f3f3f3f;
	int ans = 0x3f3f3f3f;
	for(int i = 1;i <= n; ++ i)
	{
		dfs(i,0);
		if(lft[i] == 0)
			ans = min(ans,dist[i] / 2);
	}
	if(ans == 0x3f3f3f3f) printf("-1\n");
	else printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define flb(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define mp make_pair
#define pb push_back
#define inf (long long)(1e18+1e15)
typedef pair<int,int> ii;
typedef vector <int> vi;
typedef vector <pair<int,int> > vii;
typedef vector <vector <int> > vvi;

int main()
{
    int n,m;
    cin>>n>>m;
    flb(i,0,m)
    {
        int x;
        cin>>x;
        n-=x;
    }
    if(n<0)
        cout<<-1;
    else
        cout<<n;
}


Measured memory_bytes: 3632
# B - ATCoder
S = str(input())
count = 0
ans = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] =='C' or S[i] == 'G' or S[i] =='T':
        count += 1
        if ans <= count:
            ans = count
        else:
            pass
    else:
        count = 0

print(ans)

Measured memory_bytes: 2940
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

struct PriorityQueue(alias _fun, T) {
    import std.functional : binaryFun;
    import std.algorithm : swap;
    alias fun = binaryFun!_fun;

    ///
    this(T[] ts) {
        foreach (t; ts) enqueue(t);
    }

    ///
    PriorityQueue!(_fun, T) enqueue(T e) {
        if (this.tree.length == 0) this.tree.length = 1;
        if (this.tree.length == this.n) this.tree.length *= 2;
        this.tree[this.n] = e;
        auto i = this.n;
        this.n += 1;
        while (i) {
            auto j = (i-1)/2;
            if (fun(this.tree[i], this.tree[j])) {
                swap(this.tree[i], this.tree[j]);
                i = j;
            } else break;
        }
        return this;
    }

    alias insertFront = enqueue;
    alias insert = enqueue;

    ///
    T dequeue() {
        auto ret = this.tree[0];
        this.n -= 1;
        this.tree[0] = this.tree[this.n];
        this.tree = this.tree[0..$-1];
        size_t i;
        for (;;) {
            auto l = i*2+1;
            auto r = i*2+2;
            if (l >= this.n) break;
            size_t j;
            if (r >= this.n) {
                j = l;
            } else {
                j = fun(this.tree[r], this.tree[l]) ? r : l;
            }
            if (fun(this.tree[j], this.tree[i])) {
                swap(this.tree[i], this.tree[j]);
                i = j;
            } else break;
        }
        return ret;
    }

    ///
    @property
    T front() {
        return this.tree[0];
    }

    ///
    @property
    bool empty() {
        return this.n == 0;
    }

    ///
    void popFront() {
        this.dequeue();
    }

    alias removeFront = popFront;

    ///
    @property
    size_t length() {
        return this.n;
    }

private:
    size_t n;
    T[] tree;
}

///
PriorityQueue!(fun, T) priority_queue(alias fun, T)(T[] ts = []) {
    return PriorityQueue!(fun, T)(ts);
}

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];
    auto AS = readln.split.to!(long[]);

    auto pq = priority_queue!("a > b", long)(AS);

    foreach (_; 0..M) {
        auto head = pq.dequeue();
        pq.enqueue(head/2);
    }

    long s;
    foreach (a; pq) s += a;
    writeln(s);
}

Measured memory_bytes: 7496
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int A = sc.nextInt();
		int P = sc.nextInt();
		int ans = (A * 3 + P) / 2;
		System.out.println(ans);
	}
}

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 double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 22484
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	string s;
	cin >> a >> b;
	cin >> s;
	if (s[a] != '-') puts("No"), exit(0);
	if (count(s.begin(), s.end(), '-') == 1) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

map<map<int,int> ,int> mp;
map<int,int> mmmp;

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

    ll ans = 0;
    int N;
    cin >> N;
    rep(i,1,N) {
        string s;
        mmmp.clear();
        cin >> s;
        rep(j,0,s.size()-1) {
            mmmp[s[j]]++;
        }
        ans += mp[mmmp];
        mp[mmmp] ++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 49152
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;


int main(){
    std::ios_base::sync_with_stdio(false);

    string s; cin >> s;

    string u=""; u+=s[0]; u+=s[1];
    string l=""; l+=s[2]; l+=s[3];

    int x = stoi(u);
    int y = stoi(l);

    //cout << x << " " << l << endl;

    bool x_month, y_month;

    if(x <= 12 && x>=1) x_month=true;
    else x_month = false;

    if(y <= 12 && y>=1) y_month=true;
    else y_month = false;   

    if(x_month && y_month){
        cout << "AMBIGUOUS" << endl;
        return 0;
    }

    if(x_month){ 
        cout << "MMYY" << endl;
        return 0;
    }

    if(y_month){ 
        cout << "YYMM" << endl;
        return 0;
    }


    cout << "NA" << endl;
    return 0;
}


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

using namespace std;

int main()
{
    long long n, k, m=10000000000, a;
    cin>>n>>k;
    long long v[n];
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    sort(v, v+n);
    for(long long i=0; i<n-k+1; i++){
        a=abs(v[i+(k-1)]-v[i]);
        if(a<m)
            m=a;
    }
    cout<<m;

    return 0;
}


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

int main(int argc, const char * argv[]) {
    string S;
    cin >> S;
    int count = 0;
    for(int i=1;i<S.size();i++){
        if(S[i]!=S[i-1]) count++;
    }
    cout << count;
    return 0;
}


Measured memory_bytes: 512
#include<set>
#include<map>
#include<list>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define qread(x) x=read()
#define mes(x,y) memset(x,y,sizeof(x))
#define mpy(x,y) memcpy(x,y,sizeof(x))
#define Maxk 200000
#define INF 2147483647
inline long long read(){
	long long f=1,x=0;char ch;
	while(!(ch>='0'&&ch<='9')){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
long long n,k,ans,a[Maxk+1];
int main(){
	qread(n),qread(k);
	mes(a,0);
	for(int i=1;i<=n;i++)a[i%k]++;
	ans=0;
	for(int i=0;i<=k;i++){
		if((2*i)%k==0){
			ans+=a[i]*a[i]*a[(k-i)%k];
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main(void){
	int n;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++)cin >> a[i];
	sort(a, a+n);
	int i = a[0]+1;
	if(n%2 == a[0]){
		cout << 0 << endl;
		return 0;
	}
	for( ; i<n; i+=2){
		if(a[i]/2==(i + (n%2? 0 : 2))/2){
			cout << 0 << endl;
			return 0;
		}
	}
	long long r = 1;
	long long m = 1e9 +7;
	for(int i=0; i<n/2; i++){
		r = (r%m * 2)%m;
	}

	cout << r << endl;
}

Measured memory_bytes: 4000
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
//snippet


#define N 1009

void run() {
	int n, a, m;
	LL ans = 0;
	in("%d", &n);
	rep(i, n) {
		in("%d", &a);
		if (!i)m = a;
		if (m == a)continue;
		if (m < a) { m = a; continue; }
		ans += m - a;
	}
	printf("%lld\n", ans);
}

int main() {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
	}
}

Measured memory_bytes: 1704
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

    vector<bool> all_like(m);
    fill(all_like.begin(), all_like.end(), true);

    for (int i = 0; i < n; i++)
    {
        int k;
        cin >> k;
        vector<bool> k_like(m);
        fill(k_like.begin(), k_like.end(), false);
        for (int j = 0; j < k; j++)
        {
            int t;
            cin >> t;
            k_like[t - 1] = true;
        }
        for (int j = 0; j < m; j++)
        {
            all_like[j] = all_like[j] & k_like[j];
        }
    }

    int cnt = 0;
    for (int i = 0; i < m; i++)
    {
        if (all_like[i])
        {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

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

using namespace std;

#define MAX 25
#define INF (1<<29)
typedef pair<int,int> P;

int H,W;
char field[MAX][MAX];
vector<P> vec;
const int dx[] = {-1,0,0,1};
const int dy[] = {0,-1,1,0};

struct State{
  int x,y,S;
  State() {}
  State(int x,int y,int S) : x(x),y(y),S(S) {}
};

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

int bfs(int sx,int sy,int gx,int gy){
  int res = INF;
  int dist[MAX][MAX];
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      dist[i][j] = INF;
    }
  }
  dist[sy][sx] = 0;
  queue<P> Q;
  Q.push(P(sx,sy));

  while(!Q.empty()){
    P p = Q.front(); Q.pop();
    if(p.first == gx && p.second == gy){
      res = dist[gy][gx];
      break;
    }
    for(int i = 0 ; i < 4 ; i++){
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if(!inField(ny,nx)) continue;
      if(field[ny][nx] == 'x') continue;
      if(dist[p.second][p.first] + 1 < dist[ny][nx]){
        dist[ny][nx] = dist[p.second][p.first] + 1;
        Q.push(P(nx,ny));
      } 
    }
  }

  return res;
}

void solve(int x,int y){
  int size = vec.size(),ans = INF;
  int dist[MAX][MAX][1<<10];
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      for(int k = 0 ; k < 1<<size ; k++){
        dist[i][j][k] = INF;
      }
    }
  }
  dist[y][x][0] = 0;
  queue<State> Q;
  Q.push(State(x,y,0));
  while(!Q.empty()){
    State now = Q.front(); Q.pop();
    if(__builtin_popcount(now.S) == size){
      ans = min(ans,dist[now.y][now.x][now.S]);
      continue;
    }

    for(int i = 0 ; i < size ; i++){
      int S = now.S;
      if(now.S >> i & 1) continue;
      S |= 1<<i;
      int nx = vec[i].second, ny = vec[i].first;
      int d = bfs(now.x,now.y,nx,ny);
      if(dist[now.y][now.x][now.S] + d < dist[ny][nx][S]){
        dist[ny][nx][S] = d + dist[now.y][now.x][now.S];;
        Q.push(State(nx,ny,S));
      } 
    }
  }

  cout << (ans == INF ? -1 : ans) << endl;
}

int main(){
  int sx,sy;
  while(cin >> W >> H, (W | H)){
    vec.clear();
    for(int i = 0 ; i < H ; i++){
      for(int j = 0 ; j < W ; j++){
        cin >> field[i][j];
        if(field[i][j] == 'o'){
          sx = j; sy = i;
        }else if(field[i][j] == '*'){
          vec.push_back(P(i,j));
        }
      }
    }
    solve(sx,sy);
  }

  return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int main() {
    int L, R, d;
    cin >> L >> R >> d;
    cout << R / d - (L - 1) / d << endl;
}

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

using namespace std;

int a[200001];
int l[200001];
int r[200001];
stack <int> st;

int main () {
	int n;
	cin >> n;
	for (int i = 1;i <= n;i ++) cin >> a[i];
	for (int i = 1;i <= n;i ++) {
		l[i] = i;
		while (st.size () && a[st.top ()] > a[i]) {
			l[i] = l[st.top ()];
			st.pop ();
		}
		st.push (i);
	}
	while (st.size ()) st.pop ();
	for (int i = n;i >= 1;i --) {
		r[i] = i;
		while (st.size () && a[st.top ()] > a[i]) {
			r[i] = r[st.top ()];
			st.pop ();
		}
		st.push (i);
	}          
	long long ans = 0;
	for (int i = 1;i <= n;i ++) {
		long long left = i - l[i] + 1;
		long long right = r[i] - i + 1;
		ans += left * right * a[i];
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>
int main(void)
{
  int H, W, i, j;
  while (1) {
    scanf("%d%d", &H, &W);
    if (H == 0 && W == 0) break;
    for (i = 0; i < H; i++) {
      if (i % 2 == 0) {
        for (j = 0; j < W; j++) {
          if (j % 2 == 0) putchar('#');
          else putchar('.');
        }
      } else {
        for (j = 0; j < W; j++) {
          if (j % 2 == 0) putchar('.');
          else putchar('#');
        }
      }
      putchar('\n');
    }
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 572
#include<iostream>
using namespace std;
int main(){
  long long res=2*10000000000;
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
    long long A,B;
    cin >> A>> B;
    res = min(res,A+B);
  }
  cout<<res;
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    l.append(b)
for i in range(n):
    k=0
    for j in range(2*m):
        if i+1==l[j]:
            k+=1
    print(k)


Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 
const int N = 1e5+4;

int main() {
	int x;
	cin >> x;
	vector<char> prime(N, true);
	prime[0] = prime[1] = false;
	for(int i = 2; i <= N; i++) {
		if(prime[i]) {
			if(i >= x) {
				cout << i << endl;
				return 0;
			}
			for(int j = i*2; j <= N; j+=i)
				prime[j] = false;
		}
	}
	return 0;
}



Measured memory_bytes: 3700
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;

class Main {
	public static void main (String args[]) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		ArrayList<Integer> List = new ArrayList<Integer>();

		try {
			for (int i=0;i<10;i++) {
				String buf = br.readLine();
				List.add(Integer.parseInt(buf));
			}
			Collections.sort(List);
			Collections.reverse(List);
			for (int i=0;i<3;i++) {
				System.out.println(List.get(i));
			}

		} catch (Exception e) {
			System.out.println("Exception!");
		}
	}
}

Measured memory_bytes: 17040
using System;
//https://atcoder.jp/contests/arc004/tasks/arc004_1
namespace _1_6_1_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ABCD = Console.ReadLine();
            int A, B, C, D;
            A = int.Parse(ABCD.Substring(0, 1));
            B = int.Parse(ABCD.Substring(1, 1));
            C = int.Parse(ABCD.Substring(2, 1));
            D = int.Parse(ABCD.Substring(3, 1));

            int bit = 0;
            int b, c, d;
            string x, y, z;
            while (true)
            {

                if ((bit & 1) > 0)
                {
                    b = B;
                    x = "+";
                }
                else
                {
                    b = -B;
                    x = "-";
                }
                if ((bit & 2) > 0)
                {
                    c = C;
                    y = "+";
                }
                else
                {
                    c = -C;
                    y = "-";
                }
                if ((bit & 4) > 0)
                {
                    d = D;
                    z = "+";
                }
                else
                {
                    d = -D;
                    z = "-";
                }

                if(A+b+c+d == 7)
                {
                    Console.WriteLine(ABCD[0] + x + ABCD[1] + y + ABCD[2] + z + ABCD[3] + "=7");
                    break;
                }
                bit++;
            }
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    vector<P> a(n);
    rep(i,n){
      cin>>a[i].second>>a[i].first;
    }
    sort(begin(a),end(a),greater<P>());
    vector<ll> cnt(n+1,0);//各種類の使われた個数
    priority_queue<P,vector<P>,greater<P>> que;
    ll ans=0;
    ll kind=0;
    vector<ll> f(n+1,0);//x種類使った時の満足ポイント
    rep(i,k){
      ans+=a[i].first;
      cnt[a[i].second]++;
      if(cnt[a[i].second]>=2){
        que.push(a[i]);
      }else{
        kind++;
      }
    }
    f[kind]=ans+kind*kind;
    if(k==n||kind==n||que.empty()){
      cout<<f[kind]<<endl;
      return 0;
    }
    FOR(i,k,n){
      if(cnt[a[i].second]!=0){
        continue;
      }
      P x=que.top();
      f[kind+1]=f[kind]-kind*kind+(kind+1)*(kind+1)-x.first+a[i].first;
      kind++;
      que.pop();
      cnt[a[i].second]++;
      cnt[x.second]--;
      if(kind==n||que.empty()){
        break;
      }
    }
    //cout_vec(f);
    cout<<*max_element(begin(f),end(f))<<endl;
}

Measured memory_bytes: 4600
#!/usr/bin/env python3

x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")

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

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

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main() { 
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }

    map<int, long long> mp;
    REP(i, N) {
        mp[A[i]] += 1;
    }

    long long sum = 0;
    for (auto x : mp) {
        sum += x.second * (x.second - 1) / 2;
    }

    REP(i, N) {
        long long cnt = mp[A[i]];
        sum -= cnt * (cnt - 1) / 2;
        sum += (cnt - 1) * (cnt - 2) / 2;
        cout << sum << endl;
        
        sum -= (cnt - 1) * (cnt - 2) / 2;
        sum += cnt * (cnt - 1) / 2;
    }
    return 0; 
}

Measured memory_bytes: 10240
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;


int main() {
    int a;
    int b;
    int c;
    cin >> a >> b;
    cout << (a+b+1)/2<< endl;
}




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

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

	string c = a + b;
	int c_int = stoi(c);

	string ans = "No";

	for (int i = 1; i*i <= 100100; i++) {
		if (i*i == c_int) ans = "Yes";
	}

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

Measured memory_bytes: 256
def north(d):
    d[0],d[1],d[4],d[5] = d[1],d[5],d[0],d[4]

def south(d):
    d[0],d[1],d[4],d[5] = d[4],d[0],d[5],d[1]

def east(d):
    d[0],d[2],d[3],d[5] = d[3],d[0],d[5],d[2]

def west(d):
    d[0],d[2],d[3],d[5] = d[2],d[5],d[0],d[3]

F = {'N':north,'W':west,'S':south,'E':east}
d,os = list(map(int,input().split())),input()
for o in os:
    F[o](d)

print(d[0])

Measured memory_bytes: 7752
/* 
 * File:   main.c
 * Author: kundaikwangwari
 *
 * Created on July 16, 2019, 2:19 PM
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define LIM 1500000


int HeapSize;

void swap(int *A, int i, int j){
    
    int temp = A[i];
    A[i] = A[j];
    A[j] = temp;
}

void Insert(int *A, int i){
    //printf("am in insert\n");
    while((i > 1) && (A[i/2] < A[i])){
        swap(A,i,i/2);
        i = i/2;
    }
}
void MaxHeapify(int *A, int i){
    //printf("am in maxheapify\n");
    int LF, RL, PN, largest;
    LF = 2*i;
    RL = 2*i + 1;
      // select the node which has the maximum value
      if((LF <= HeapSize) && (A[LF] > A[i]))largest = LF;
      else largest = i;
      if((RL <= HeapSize) && (A[RL] > A[largest]))largest = RL;
    
     if(largest != i){
         // value of children is larger than that of i
         swap (A,i,largest);
         MaxHeapify(A,largest);
     }
}

void HeapExtractMax(int *A){
    //printf("in heapextract\n");
    int topValue;
/*
    if(HeapSize < 1){
        printf("Error, HeapSize underflow. Program terminated...\n");
        return;
    }
*/
    
    topValue = A[1];
    A[1] = A[HeapSize];
    HeapSize--;
    MaxHeapify(A,1);
    printf("%d\n",topValue);
    return;
    
}

int main(int argc, char** argv) {

    
    int sol;
    char cmd[12];
    int A[LIM];
    A[0] = -1;
    for(int i = 1;; i++){
       
        //printf("extracting\n");
        scanf("%s",&cmd);
        

        if(cmd[2]=='d'){
            //printf("end reached");
            break;
        }
        if(cmd[0] == 'i'){
            HeapSize++;
            scanf("%d",&A[HeapSize]);
            Insert(A,HeapSize);
            continue;
        }
        if(cmd[1]=='x'){
            HeapExtractMax(A);
            continue;
        }
               
    }
 return 0;   
}








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

int main(){
    long long n,k;
    cin >> n >> k;
    if(k>=n){
        cout << 0 << endl;
        return 0;
    }
    long long a[n];
    long long b[n];
    for(int i=0;i<n;i++) b[i]=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        b[a[i]-1]++;
    }
    sort(b,b+n);
    reverse(b,b+n);
    long long count=0;
    for(int i=0;i<k;i++){
        count+=b[i];
    }
    cout << n-count << endl;
    return 0;
}

Measured memory_bytes: 3328
//
#include<iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int x=n;
    cout << n << ":";
    for(int i=2; i*i<=x; i++) {
        while(n%i==0) {
            cout << " " << i;
            n/=i;
        }
    }
    if(n!=1)
        cout << " " << n;
    cout << endl;
    return 0;
}




Measured memory_bytes: 3120
//だめなやつ
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define fo(i,s,e) for (int i=(s); i < (e); i++)
signed main () {
  int n,m,x;cin>>n>>m>>x;
  vector<vector<int>> v(n,vector<int>(m+1,0));
  rep(i,n) rep(j,m+1) cin>>v[i][j];
  int ans=INT_MAX;
  rep(bit,1<<n){
    bool check_bit=true;
    fo(j,1,m+1){
      int sum_j=0;
      rep(i,n) if((bit>>i)&1) sum_j+=v[i][j];
      if(sum_j<x) check_bit=false;
    }
    if(check_bit){
      int sum_c=0;
      rep(i,n) if((bit>>i)&1) sum_c+=v[i][0];
      ans=min(ans,sum_c);
    }
  }
  if(ans==INT_MAX) cout << -1 << endl;
  else cout << ans << endl;
}

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


int main(void)
{
	//変数の宣言
	
	int d;
	
	//データの読み込み
	
	scanf("%d",&d);
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	if(d==25) printf("Christmas");
	if(d==24) printf("Christmas Eve");
	if(d==23) printf("Christmas Eve Eve");
	if(d==22) printf("Christmas Eve Eve Eve");
	
/*	for(i=0;i<n;i++){
		if(i!=0) printf(" ");
		printf("%d",a[i]);
	}
	
	printf("\n");
	
	for(i=0;i<n;i++){
		if(i!=0) printf(" ");
		printf("%d",b[i]);
	}
	printf("\n");
*/	
	
	
	
	
	
	
//	printf("計算部分終了\n");
	
	//出力
	
	
//	printf("結果の出力終了\n");
	
	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y, h;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++)
		sum *= (x--);
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n;
int a[5];
unordered_map<char, int>hush;
signed main() {
	hush['M'] = 0; hush['A'] = 1; hush['R'] = 2; hush['C'] = 3; hush['H'] = 4;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		if (s[0] == 'M' || s[0] == 'A' || s[0] == 'R' ||
			s[0] == 'C' || s[0] == 'H')
			a[hush[s[0]]]++;
	}
	int sum = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int z = j + 1; z < 5; z++) {
				sum += a[i] * a[j] * a[z];
			}
		}
	}
	cout << sum << endl;
	getchar(); getchar();
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int main() {
  string S;
  cin >> S;
  cout << S[0] << S[1] << S[2] << endl;

  return 0;
}

Measured memory_bytes: 3596
/*

*/
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout << setprecision(12)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((ll)(x).size())
#define cin1(x) cin >> x
#define cin2(x, y) cin >> x >> y
#define cin3(x, y, z) cin >> x >> y >> z
#define cin4(x, y, z, _) cin >> x >> y >> z >> _
#define cin5(x, y, z, p, q) cin >> x >> y >> z >> p >> q
#define cou(x) cout << x
#define cous(x) cout << x << " "
#define coul(x) cout << x << "\n"
#define ret(x) return x
#define MAX 5000001
#define start int main() {   fastio
#define finish ret(0); }
#define Test ll _t; cin1(_t); rep(w, 0, _t)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cntv(v,a) count(v.begin(),v.end(),a)
struct point{    int x, y, ind;   char ch;  };
typedef long long ll;
typedef vector<ll> VI;
typedef pair<ll,ll> PII;
typedef double db;
//mt19937 mrand(random_device{}());
const ll mod=1000000007;
//ll rnd(ll x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}ret(res);}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll fact[13];
void factorial() {   fact[0]=1;  rep(i, 1, 12) fact[i]=(fact[i-1]*i);  }
vector <ll> sie; //for sieve function
ll spf[MAX+7];  //for sieve function
void sieve() {    rep(i, 2, MAX)  {  if (spf[i] == 0) {  spf[i] = i;   sie.pb(i);  }    for (ll j=0; j<SZ(sie) && i*sie[j] <= MAX && sie[j] <= spf[i]; j++)   spf[i * sie[j]] = sie[j]; }   }
bool cmp(point A, point B){   if(A.x != B.x) ret(A.x < B.x);  ret(A.y < B.y);   }
// head collected
// Don't use variable name as --> prev, time, _t, w, y1

ll t, n, k, _, __,ans, re;
string str;
ll ara[100007];

start;

    cin1(t);

    //rep(i, 1, 221) cous(i*2);

    if ( t & 1 ) {
        coul("0");
        ret(0);
    }

    _  = 10;
    while ( 1 ){
        __ = t / _;
        if ( __ == 0 )
            break;
        _ *= 10;
        ans += __;
    }

    t = t / 10;
    _ = 5;
    while ( 1 ){
        __ = t / _;
        if ( __ == 0 )
            break;
        _ *= 5;
        ans += __;
    }

    t = t *10;
    _ = 100;
    while ( 1 ){
        __ = t / _;
        if ( __ == 0 )
            break;
        _ *= 10;
        ans -= __;
    }


    coul(ans);

finish


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


void solve()
{
	int N;
	cin>>N;

	int c0 = 0,c1 = 0,c2 = 0,c3 = 0;

	string S;

	while(N--)
	{
		cin>>S;

		if(S == "AC")
			c0++;

		else if(S == "WA")
			c1++;

		else if(S == "TLE")
			c2++;

		else
			c3++;
	}

	cout<<"AC x "<<c0<<endl;
	cout<<"WA x "<<c1<<endl;
	cout<<"TLE x "<<c2<<endl;
	cout<<"RE x "<<c3<<endl;
	
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);


	solve();

	return 0;
} 

Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

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

	while(n--)
	{
		set<string> ss;
		string str;
		cin >> str;

		int n = str.size();
		string a, b, buf;
		for(int i = 1; i < n; i++)
		{
			a = str.substr(0, i), b = str.substr(i, n - i);
			buf = a;

			ss.insert(a + b); ss.insert(b + a);
			reverse(ALL(a));
			ss.insert(a + b); ss.insert(b + a);
			reverse(ALL(b));
			ss.insert(a + b); ss.insert(b + a);
			ss.insert(b + buf); ss.insert(buf + b);
		}

		cout << ss.size() << endl;
	}
}

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

int main()
{
	int N;
	double money[10], ans = 0.0;
	string num[10];

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> money[i];
		cin >> num[i];
	}

	for (int j = 0; j < N; j++) {
		if (num[j] == "JPY") {
			ans += money[j];
		}

		else if (num[j] == "BTC") {
			ans += money[j] * 380000.0;
		}
	}

	cout << ans << endl;
}

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


int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t;
  cin>>a>>b;
  cin>>u;

  if(u==s)
    a--;
  else
    b--;
  
  
  cout<<a<<" "<<b<<endl;
  return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int dd[] = {-1, 0, 1, 0, -1};

struct state {
    int x, y, d;
    ll turn;
};

int main(){
    cin.sync_with_stdio(false);
    int h, w;
    ll l;
    while(cin >> h >> w >> l, h) {
        ll maze[h + 2][w + 2][4];
        rep(i, h + 2)rep(j, w + 2)rep(k, 4) maze[i][j][k] = INF;

        state s;
        repl(i, 1, h + 1)repl(j, 1, w + 1) {
            char c;
            cin >> c;
            if (c == '.') rep(k, 4) maze[i][j][k] = -1;
            else if (c != '#') {
                switch(c) {
                    case 'N': s.d = 0; break;
                    case 'E': s.d = 1; break;
                    case 'S': s.d = 2; break;
                    case 'W': s.d = 3; break;
                }
                s.x = j, s.y = i, s.turn = 0;
                rep(k, 4) maze[i][j][k] = -1;
            }
        }

        while (true) {
            if (maze[s.y][s.x][s.d] >= 0) {
                s.turn = (l - maze[s.y][s.x][s.d]) / (s.turn - maze[s.y][s.x][s.d])
                * (s.turn - maze[s.y][s.x][s.d]) + maze[s.y][s.x][s.d];
            }
            maze[s.y][s.x][s.d] = s.turn;
            if (s.turn == l) break;
            while (maze[s.y + dd[s.d]][s.x + dd[s.d + 1]][s.d] == INF) {
                s.d = (s.d + 1) % 4;
            }
            s.y += dd[s.d], s.x += dd[s.d + 1];
            s.turn++;
        }

        char c;
        switch(s.d) {
            case 0: c = 'N'; break;
            case 1: c = 'E'; break;
            case 2: c = 'S'; break;
            case 3: c = 'W'; break;
        }

        cout << s.y << " " << s.x << " " << c << endl;
    }

    return 0;
}

Measured memory_bytes: 3448
import java.util.*;
class Main{
	  public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
	    int a = sc.nextInt();
	    int b = sc.nextInt();
	    int one = 0;
	    int two = 0;
	    int three = 0;
	    int max = 0;
	    
	    one = a + b;
	    max = one;
	    
	    two = a - b;
	    if(max < two) {
	    	max = two;
	    }
	    
	    three = a * b;
	    if(max < three) {
	    	max = three;
	    }
	    System.out.println(max);
	    
	    
	  }
	  }

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

int main()
{
    int n, *a;

    cin >> n;
    a = new int[n];

    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = n - 1; i >= 0; i--) {
        if (i)
            cout << a[i] << ' ';
        else
            cout << a[i] << endl;
    }

    delete[] a;
    a = 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //required
// #include <ext/pb_ds/tree_policy.hpp> //required

// using namespace __gnu_pbds; 
using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // ordered_set <ynt> s; // order_of_key(value)

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second


// const long long N = ;
long long n, k, m, a, b;

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

	cin >> n >> k;
	long long ans = 0;
	for(long long b= 1; b <= n; b++) {
		long long cnt = n / b;
		ans += cnt * min(k, b);
		long long r = n % b;
		if(k > 0)
		ans += min(r, k - 1);
		// dbg(b, ans);
	}
	cout << n * n - ans << '\n';
}	


Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int n, m;
  cin >> n >> m;
  scc_graph g(n);
  while(m--){
    int a, b;
    cin >> a >> b;
    g.add_edge(a, b);
  }
  auto res = g.scc();
  print(SZ(res));
  for(auto&& e: res){
    cout << SZ(e) << " ";
    print(e);
  }
}


Measured memory_bytes: 40084