akhauriyash/Code-Regression huggingface dataset:
import java.util.*;


public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int h = sc.nextInt();
			int w = sc.nextInt();
			char [][] data = new char[h][w];
			for(int i = 0; i < h; i++){
				data[i] = sc.next().toCharArray();
			}
			
			boolean flg = true;
			int [] dx = {0,1,0,-1};
			int [] dy = {1,0,-1,0};
			for(int i =0; i < h; i++){
				for(int j = 0; j < w; j++){
					if(data[i][j] == '.'){
						continue;
					}
					boolean flg2 = false;
					for(int k = 0; k < 4; k++){
						int xx = j + dx[k];
						int yy = i + dy[k];
						if(0 <= xx && xx < w && 0 <= yy && yy < h){
							if(data[yy][xx] == '#'){
								flg2 = true;
								break;
							}
						}
					}
					if(!flg2){
						flg = false;
						break;
					}
				}
			}
			System.out.println(flg ? "Yes" : "No");
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


Measured memory_bytes: 21716
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string S;
    cin>>S;
    int res=S.size();
    int a=S.size();
    for(int i=1; i<S.size(); i++)
    {
        if(S[i]!=S[i-1])
            res=min(res,max(i,a-i));
    }
    cout<<res<<endl;
    return 0;

}


Measured memory_bytes: 512
fun main() {
    val input2 = rspint()
    function(input2[0], input2[1])
}

fun function(in1: Int, in2: Int) {
    if (in1 > in2)
        println("safe")
    else
        println("unsafe")
}

inline fun rsp() = readLine()!!.split(" ")

inline fun rspint() = rsp().map(String::toInt)

Measured memory_bytes: 36416
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int a[123456*2+10];

signed main()
{
	//IOS();
	vector<int>ans;
	rep(i,2,123456*2+1)a[i] = 1;
	rep(i,2,123456*2+1){
		if(a[i] == false)continue;
		for(int j=i*2;j<123456*2+1;j+=i){
			a[j] = 0;
		}
	}
	
	while(1){
		int N;
		cin>>N;
		if(!N)break;
		int cnt = 0;
		rep(i,N+1,N*2+1)if(a[i])cnt++;
		ans.push_back(cnt);
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}



Measured memory_bytes: 5068
#include<stdio.h>
int x[10000],y[10000],f[10000];
int main(){
	int n,m,i,cnt1=0,cnt2,j;
	while(1){
		int p[501]={0};
		p[1]=1;
		cnt1=0;
		scanf("%d %d",&n,&m);
		if(n==0&&m==0){
			break;
		}
		for(i=0;i<m;i++){
			scanf("%d %d",&x[i],&y[i]);
			if(x[i]==1&&p[y[i]]==0){
				p[y[i]]=1;
				f[cnt1]=y[i];
				cnt1++;
			}
			if(y[i]==1&&p[x[i]]==0){
				p[x[i]]=1;
				f[cnt1]=x[i];
				cnt1++;
			}
		}
		cnt2=cnt1;
		for(i=0;i<cnt2;i++){
			for(j=0;j<m;j++){
				if(f[i]==x[j]&&p[y[j]]==0){
					p[y[j]]=1;
					cnt1++;
				}
				if(f[i]==y[j]&&p[x[j]]==0){
					p[x[j]]=1;
					cnt1++;
				}
			}
		}
		printf("%d\n",cnt1);
	}
	return 0;
}

Measured memory_bytes: 2792
(let ((a (read))
      (b (read))
      (ap nil)
      (bp nil)
      (cnt 0))
  (loop :for i :from 2 :to (floor (sqrt a))
        :do (loop :with flg := t
                  :while (= (mod a i) 0)
                  :do (setf a (/ a i))
                  :do (when flg 
                        (push i ap)
                        (setf flg nil))))
  (when (/= a 1)
    (push a ap))
  (loop :for i :from 2 :to (floor (sqrt b))
        :do (loop :with flg := t
                  :while (= (mod b i) 0)
                  :do (setf b (/ b i))
                  :do (when flg 
                        (push i bp)
                        (setf flg nil))))
  (when (/= b 1)
    (push b bp))
  (loop :while (and ap bp)
        :do (cond ((= (car ap) (car bp))
                   (incf cnt)
                   (setf ap (cdr ap))
                   (setf bp (cdr bp)))
                  ((> (car ap) (car bp))
                   (setf ap (cdr ap)))
                  ((< (car ap) (car bp))
                   (setf bp (cdr bp)))))
  (format t "~A~%" (1+ cnt)))


Measured memory_bytes: 24620
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif
    int T=1;
    // cin >> T;
    FOR1(tt, T){
    	// cout << "Case #" << tt << ": ";
        string s;
        cin >> s;
        if(s[0] == 'R' and s[1] == 'R' and s[2] == 'R') cout << 3;
        else if(s[0] == 'R' and s[1] == 'R' or s[1] == 'R' and s[2] == 'R') cout << 2;
        else if(s[0] == 'R' or s[1] == 'R' or s[2] == 'R') cout << 1;
        else cout << 0;
    	cout << '\n';
    }
	return 0;
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;

namespace AISA
{
    static class MainClass
    {

        public static void Main(string[] args)
        {


            int N = int.Parse(Console.ReadLine());
            int H = int.Parse(Console.ReadLine());
            int W = int.Parse(Console.ReadLine());


            Console.WriteLine((N-H+1)*(N-W+1));

            return;


        }



        public static long Gcd(long a, long b)
        {
            long tmp;
            // a<bにする
            if (a >= b)
            {
                tmp = a;
                a = b;
                b = tmp;
            }

            if (a == 0)
            {
                return b;
            }

            tmp = a;
            a = b % a;
            b = tmp;
            return Gcd(a, b);

        }


        public static IEnumerable<long> PF(long n)
        {
            long i = 2;
            long tmp = n;

            while (i * i <= n) //※1
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;//最後の素数も返す
        }




    }

}






Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<limits>
#include<deque>
#include<string>
#include<map>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>

using namespace std;


int main() {
	int h, w; cin >> h >> w;
	char a;
	int i, sum = 0;

	for (i = 0; i < h*w; i++) {
		cin >> a;
		if (a == '.') { sum++; }
	}

	if (sum == (w - 1)*(h - 1)) { cout << "Possible" << endl; }
	else { cout << "Impossible" << endl; }


	return 0;
}

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans_t = 10000
ans = 0

for i in range(N):
	# Hi地点でのA度との平均気温の差分
	t = abs(A - (T - H[i] * 0.006))

	if ans_t > t:
		ans_t = t
		ans = i + 1

print(ans)




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

int main(){
    int n,k;
    cin >> n >> k;
    ld ans=0;
    for(int i=1;i<=n;i++){
        double tmp=1.0/n;
        int point = i;
        while(point<k){
            tmp=tmp/2;
            point=point*2;
        }
        ans+=tmp;
    }
    cout << setprecision(12)<< ans << endl;
    return 0;
}

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

class Unionfind{
public:
  vector<int> par;
  vector<int> rak;

  Unionfind(int n): par(n), rak(n, 0){
    for(int i=0; i<n; ++i) par[i] = i;
  }

  int root(int x){
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  bool same(int x, int y){
    return root(x) == root(y);
  }

  void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(rak[x] < rak[y]) par[x] = y;
    else{
      par[y] = x;
      if(rak[x] == rak[y]) rak[x]++;
    }
  }
};

struct Edge{
  int s;
  int t;
  int w;
  Edge(int S, int T, int W) : s(S), t(T), w(W){ };
};

bool comp(const Edge &e1, const Edge &e2){
  return e1.w < e2.w;
}

int main(){
  int n;
  cin >> n;
  vector<pair<int, int>> town(n);
  vector<pair<int, int>> x(n);
  vector<pair<int, int>> y(n);
  for(int i=0; i<n; ++i){
    int s, t;
    cin >> s >> t;
    town[i] = make_pair(s, t);
    x[i] = make_pair(s, i);
    y[i] = make_pair(t, i);
  }

  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  vector<Edge> es;
  for(int i=0; i<n-1; ++i){
    int x1 = x[i].second;
    int x2 = x[i+1].second;
    es.push_back(Edge(x1, x2, min(abs(town[x1].first-town[x2].first), abs(town[x1].second-town[x2].second))));
    int y1 = y[i].second;
    int y2 = y[i+1].second;
    es.push_back(Edge(y1, y2, min(abs(town[y1].first-town[y2].first), abs(town[y1].second-town[y2].second))));
  }

  sort(es.begin(), es.end(), comp);
  Unionfind kruskal(n);
  int ans = 0;
  for(int i=0; i<es.size(); ++i){
    Edge e = es[i];
    if(!kruskal.same(e.s, e.t)){
      kruskal.unite(e.s, e.t);
      ans += e.w;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 7284
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<ll,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args> void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  string s;
  cin >> s;
  int n = s.size();
  bool nswe[4] = {false};
  rep(i,n) {
    if (s[i] == 'N') nswe[0] = true;
    else if (s[i] == 'S') nswe[1] = true;
    else if (s[i] == 'W') nswe[2] = true;
    else if (s[i] == 'E') nswe[3] = true;
  }
  bool ok = false;
  if (nswe[0] == nswe[1] && nswe[2] == nswe[3]) ok = true;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int a, b, c, i, j;
	cin >> a >> b >> c;
	j = 0;
	for (i = a; i <= b; i++) {
		if (c % i == 0) {
			j++;
		}
	}
	cout << j << endl;
	
	return 0;
}


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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    unordered_set<int> U1, U2, U3;
    for (int i = 0; i < N; ++i) {
        int s = S.at(i) - '0';
        for (int t : U2)
            U3.insert(10 * t + s);
        for (int t : U1)
            U2.insert(10 * t + s);
        U1.insert(s);
    }
    cout << U3.size() << endl;
}


Measured memory_bytes: 3692
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(true){
            int t = sc.nextInt();
            int n = sc.nextInt();
            if(t+n==0)break;
            int[][]f = new int[500][500];
            int offset = f.length/2;
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt()+offset;
                int y = sc.nextInt()+offset;
                f[x][y] = -1;
            }
            int sx = sc.nextInt()+offset, sy = sc.nextInt()+offset;

            Queue<int[]>q = new LinkedList<int[]>();
            q.add(new int[]{sx,sy,0});
            f[sx][sy]=1;
            int[] v1 = {0,0,1,1,-1,-1};
            int[] v2 = {-1,1,0,1,0,-1};
            while(!q.isEmpty()){
                int x  =q.peek()[0];
                int y  =q.peek()[1];
                int ct = q.poll()[2];
                if(ct==t)continue;
                for (int i = 0; i < v2.length; i++) {
                    int xx = x+v1[i];
                    int yy = y+v2[i];
                    if(f[xx][yy]==0){
                        f[xx][yy]=1;
                        q.add(new int[]{xx,yy,ct+1});
                    }
                }
            }
            int ans=0;
            for (int i = 0; i < f.length; i++) {
                for (int j = 0; j < f[i].length; j++) {
                    if(f[i][j]==-1)continue;
                    ans+=f[i][j];
                }
            }
            System.out.println(ans);
        }
    }

}

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

using db = double;
const db eps = 1e-9;
int sgn(db a, db b = 0) {
	a -= b;
	return (a > eps) - (a < -eps);
}

struct poi {
	db x, y;
	poi operator -(poi p) {
		return {x - p.x, y - p.y};
	}
	bool operator <(poi p) const {
		return tie(x, y) < tie(p.x, p.y);
	}
	db cross(poi p) {
		return x * p.y - y * p.x;
	}
	db len() {
		return sqrt(x * x + y * y);
	}
};
db xmul(poi a, poi b, poi c) {
	return (b - a).cross(c - a);
}

using vp = vector <poi>;
vp convex(vp v) {
	sort(v.begin(), v.end()); vp r;
	for(int i = 0; i < v.size(); i ++) {
		while(r.size() > 1 &&
			sgn(xmul(*++r.rbegin(), v[i], *r.rbegin())) >= 0)
			r.pop_back();
		r.push_back(v[i]);
	}
	int d = r.size();
	for(int i = (int)v.size() - 2; i >= 0; i --) {
		while(r.size() > d &&
			sgn(xmul(*++r.rbegin(), v[i], *r.rbegin())) >= 0)
			r.pop_back();
		if(i != 0) r.push_back(v[i]);
	}
	return r;
}

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(false);
	int n; cin >> n; vp v;
	for(int i = 0; i < n; i ++) {
		db x, y; cin >> x >> y;
		v.push_back({x, y});
	}
	v = convex(v);

	n = v.size();

	{
		db ans = 0;
		auto upd = [&](int i, int j) {
			db t = (v[i] - v[j]).len();
			if(t > ans) ans = t;
		};
		int j = 0;
		for(int i = 0; i < n; i ++) {
			while(sgn(xmul(v[i], v[(i + 1) % n], v[j]),
				xmul(v[i], v[(i + 1) % n], v[(j + 1) % n])) < 0)
				j = (j + 1) % n;
			//cout << i << ' ' << j << '\n';
			upd(i, j); upd((i + 1) % n, j);
			upd(i, (j + 1) % n); upd((i + 1) % n, (j + 1) % n);
		}
		cout << ans << '\n';
	}

	return 0;
}

Measured memory_bytes: 5456
#include <stdio.h>

int main (){
  int x;
  int y;
  while(1){
  scanf("%d %d", &x,&y);
  if(x < y){
    printf("%d %d\n",x , y);
  }else{
    if(x == 0&& y ==0)break;
    printf("%d %d\n", y,x);
   }
  }
  return 0;
    
}

Measured memory_bytes: 600
a = list(map(int, input().split()))
b1 = abs(a[0]-a[1])+abs(a[1]-a[2])
b2 = abs(a[0]-a[2])+abs(a[2]-a[1])
b3 = abs(a[1]-a[0])+abs(a[0]-a[2])
b4 = abs(a[1]-a[2])+abs(a[0]-a[2])
b5 = abs(a[2]-a[0])+abs(a[0]-a[1])
b6 = abs(a[2]-a[1])+abs(a[0]-a[1])
ans = min(b1, b2, b3, b4, b5, b6)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int n;
string w;
vector<string> vw;

bool solve(int p, int size) {
    int w_count = p;
    int tmp_count = 0;
    
    // 5
    for (int i = w_count; i < size; ++i, ++w_count) {
        tmp_count += vw[w_count].length();
        if (tmp_count == 5) break;
        if (tmp_count > 5) return false;
    }
    w_count++;

    // 7
    tmp_count = 0;
    for (int i = w_count; i < size; ++i, ++w_count) {
        tmp_count += vw[w_count].length();
        if (tmp_count == 7) break;
        if (tmp_count > 7) return false;
    }
    w_count++;

    // 5
    tmp_count = 0;
    for (int i = w_count; i < size; ++i, ++w_count) {
        tmp_count += vw[w_count].length();
        if (tmp_count == 5) break;
        if (tmp_count > 5) return false;
    }
    w_count++;

    // 7
    tmp_count = 0;
    for (int i = w_count; i < size; ++i, ++w_count) {
        tmp_count += vw[w_count].length();
        if (tmp_count == 7) break;
        if (tmp_count > 7) return false;
    } 
    w_count++; 
    
    // 7
    tmp_count = 0;
    for (int i = w_count; i < size; ++i, ++w_count) {
        tmp_count += vw[w_count].length();
        if (tmp_count == 7) break;
        if (tmp_count > 7) return false;
    }

    return true;
}

int main (int argc, char *argv[]) {
    while (cin>>n, n) {
        for (int i = 0; i < n; ++i) {
            cin>>w;
            vw.push_back(w);
        }
        for (int i = 0; i < n; ++i) {
            if (solve(i, n)) {
                cout<<i+1<<endl;
                break;
            }   
        }
        vw.clear();
    }

    return 0;
}

Measured memory_bytes: 3156
def main():
    import sys
    input = sys.stdin.readline
    
    N,C = map(int,input().split())
    STC = []
    B = [[0]*(10**5+1) for _ in range(C)]
    for i in range(N):
        s,t,c = map(int,input().split())
        for j in range(s,t+1):
            B[c-1][j] = 1
    
    x = 0
    flag = 1
    nowc = -1
    while flag == 1:
        flag = 0
        x += 1
        nowc = -1
        for i in range(1,10**5+1):
            if nowc != -1:
                if B[nowc][i] == 1:
                    B[nowc][i] = 0
                else:
                    nowc = -1
                    for j in range(C):
                        if B[j][i] == 1:
                            nowc = j
                            B[j][i] = 0
                            break
            else:
                for j in range(C):
                    if B[j][i] == 1:
                        flag = 1
                        nowc = j
                        B[j][i] = 0
                        break
    print(x-1)

main()    

Measured memory_bytes: 66652
import java.util.Scanner;

public class Main {
	int r, g;

	public static void main(String[] args) {
		Main a = new Main();
		a.read();
		a.solve();
	}

	public void read() {
		Scanner sc = new Scanner(System.in);
		r = sc.nextInt();
		g = sc.nextInt();
	}

	public void solve() {
		int target = 0;
		target = 2*g - r;
		System.out.println(target);
	}
}


Measured memory_bytes: 25172
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#include <iomanip>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int h, w, n;
	cin >> h >> w >> n;
	set <pair<int, int>> st, black;
	auto addPoints = [&] (int a, int b) {
		int x1 = max(1, a - 2);
		int y1 = max(1, b - 2);
		int x2 = min(h, a + 2);
		int y2 = min(w, b + 2);
		for (int i = x1; i <= x2; i++) {
			for (int j = y1; j <= y2; j++) {
				st.insert({i, j});
			}
		}
	};
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		addPoints(a, b);
		black.insert({a, b});
	}
	auto calcPoints = [&](int x, int y) {
		int c = 0;
		for (int i = x; i < x + 3; i++) {
			for (int j = y; j < y + 3; j++) {
				if (black.find({i, j}) != black.end()) {
					c++;
				}
			}
		}
		return c;
	};
	vector <ll> ans(10);
	for (auto g : st) {
		if (g.ff + 2 <= h && g.ss + 2 <= w) {
			int val = calcPoints(g.ff, g.ss);
			ans[val]++;
		}
	}
	ll sum = 0;
	for (int i = 1; i < 10; i++) {
		sum += ans[i];
	}
	ans[0] = 1LL * (h - 2) * (w - 2) - sum;
	for (int i = 0; i < 10; i++) {
		cout << ans[i] << "\n";
	}
}
		


Measured memory_bytes: 124160
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define int      long long int
#define MOD      1000000007
#define pb       push_back
#define mp       make_pair
#define vi       vector<int>
#define mi  	 map<int,int>
#define umi		 unordered_map<int,int>
#define pii      pair<int,int>
#define ff 		 first
#define ss 		 second
#define inf		 1e12
#define case	int t;cin>>t;while(t--)
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void pre()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int dp[104][100010];

int32_t main()
{	//pre();
	//case
	{	int n, W;
		cin >> n >> W;
		int v[n], wt[n], s = 0;
		for (int i = 0; i < n; i++)
		{	cin >> wt[i] >> v[i];
			s += v[i];
		}
		for (int i = 0; i <= n + 1; i++)
			for (int j = 0; j <= 100001; j++)
				dp[i][j] = inf;
		for (int i = 0; i <= n + 1; i++)
			dp[i][0] = 0;
		int as = 0;
		for (int i = 1; i <= n; i++)
		{	for (int j = 1; j <= s ; j++)
			{	if (v[i - 1] <= j)
					dp[i][j] = min(dp[i - 1][j - v[i - 1]] + wt[i - 1], dp[i - 1][j]);
				else
					dp[i][j] = dp[i - 1 ][j];
				//		cout << dp[i][j] << " ";
			}
			//	cout << endl;
		}
		for (int i = 0; i <= s; i++)
			if (dp[n][i] <= W)
				as =  i;
		cout << as << endl;

	}
	return 0;
}

Measured memory_bytes: 80128
h, w, tar = [int(i) for i in input().split()]

line = []
for i in range(h):
    a = input()
    line.append([k for k in a])

ans = 0


import itertools
hs = []
for i in range(h + 1):
    hs.extend(list(itertools.combinations(range(h), i)))

ws = []
for i in range(w + 1):
    ws.extend(list(itertools.combinations(range(w), i)))

for i in hs:
    for j in ws:
        res = 0
        for k in range(h):
            for l in range(w):
                if line[k][l] == "#" and (k not in i) and (l not in j):
                    res += 1
        if res == tar:
            ans += 1


print(ans)

Measured memory_bytes: 68808
#include <iostream>
#include <string>
#include <deque>

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

    std::string initial;
    std::cin >> initial;

    int queryCount = 0;
    std::cin >> queryCount;

    std::deque<std::string::value_type> work(initial.begin(), initial.end());
    auto inverted = false;
    for (auto count = 0; count < queryCount; ++count)
    {
        int instruction = 0;
        std::cin >> instruction;
        if (instruction == 1)
        {
            inverted = !inverted;
        }
        else
        {
            int option = 0;
            std::cin >> option;
            auto optionInvert = inverted;
            if (option == 1)
            {
                optionInvert = !optionInvert;
            }

            auto append = '\0';
            std::cin >> append;

            if (optionInvert)
            {
                work.push_front(append);
            }
            else
            {
                work.push_back(append);
            }
        }
    }

    if (inverted)
    {
        std::cout << std::string(work.rbegin(), work.rend());
    }
    else
    {
        std::cout << std::string(work.begin(), work.end());
    }
    
    return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H - h) * (W - w) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)



int main() {
    int k;
    cin >> k;
    cout << ((k + 1) / 2) * (k / 2) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
   
int main()
{
 int x=100000;
 int i,n;
 scanf("%d",&n);

 for(i=0; i<n; i++){
  x = x * 1.05;
  if(x % 1000 != 0)
   x=(x/1000+1)*1000;
 }
 printf("%d\n",x);
  
 return 0;
}

Measured memory_bytes: 592
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: u32 = s.trim().parse().unwrap();
    for x in 0..(n + 1) {
        if x * 108 / 100 == n {
            println!("{}", x);
            return;
        }
    }
    println!(":(");
}

fn main() {
    run();
}

Measured memory_bytes: 4352
//***___********* ___*****___****___***___*********//
/*  |   \  |   | |   |   |   \  |     |     |   |  **
/*  |   |  |   | |___|   |   _  |__   |___  |___|  **
/*  |   |  |   | |   \   |  | | |         | |   |  **
/*  |___/  |___| |    \  |__| | |___  ____| |   |  **
//*************************************************/
#include<bits/stdc++.h>
#define ff double
#define endl "\n"
#define M 1000000007
#define forever while(1)
#define ll long long
#define pb push_back
#define vi vector<long long>
#define mii map<int,int>
#define pii pair<int,int>
#define set_zero(arr) memset(arr,0,sizeof(arr))
#include <ext/pb_ds/tree_policy.hpp>
#define forn(i,n) for(int i=0;i<(n);i++)
#include <ext/pb_ds/assoc_container.hpp>
#define fori(i,a,b) for(int i=(a);i<=(b);i++)
#define TEST_CASE   int t;cin>>t;while(t--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define buffer cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

int read()
{
	char ch=getchar();int f=0;
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {f=f*10+(ch^48);ch=getchar();}
	return f;
}
bool check(int n){
    int cnt = 0;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0)return false;
    }
    return true;
}

vi tre[100000];

bool ans = true;
bool vis[100000] = { false };
void dfs(int s){
    vis[s]=true;
    if(tre[s].size()>1){
        int cnt = 0;
        for(int i=0;i<tre[s].size();i++){
            int child = tre[s][i];
            if(tre[child].size()==1){
                cnt++;
            }
        }
        if(cnt<3){
            ans=false;
        }
    }
    for(int i=0;i<tre[s].size();i++){
        if(vis[tre[s][i]]==false)
            dfs(tre[s][i]);
    }
}
void solve(){
ll n,a,b;
cin>>n>>a>>b;
cout<<n/(a+b)*a+min(n%(a+b),a)<<endl;
}


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



Measured memory_bytes: 2560
from collections import Counter
from itertools import permutations

N, C = map(int, input().split())
D = [list(map(int, input().split())) for i in range(C)]
c = [list(map(lambda s: int(s) - 1, input().split())) for i in range(N)]

d = [Counter(sum([c[j][(i - j) % 3::3] for j in range(N)], []))
     for i in range(3)]
ans = 1000000007
for t in permutations(range(C), 3):
    dis = 0
    for i in range(3):
        for k, v in d[i].items():
            dis += D[k][t[i]] * v
    ans = min(dis, ans)
print(ans)


Measured memory_bytes: 14156
// ------------------------------------
// Date:2018/ 3/17
// Problem:./ ./ ./ ans_c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

static const int INF = 1e9 + 1;
static const int MAX_N = 1;

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

  int N;
  cin >> N;
  vector< pair< int, int > > red(N);
  REP(ri, N) {
    int a, b;
    cin >> a >> b;
    red[ri] = make_pair(a, b);
  }
  vector< pair< int, int > > blue(N);
  REP(bi, N) {
    int c, d;
    cin >> c >> d;
    blue[bi] = make_pair(c, d);
  }

  sort(ALL(red), [](pair< int, int > x, pair< int, int > y) { return x.first < y.first; } );
  sort(ALL(blue), [](pair< int, int > x, pair< int, int > y) { return x.first < y.first; } );

  int ans = 0;
  int mx, my, selectedRed, selectedBlue;
  REP(bi, blue.size()) {
    mx = my = -1;
    REP(ri, red.size()) {
      if (red[ri].first < blue[bi].first and red[ri].second < blue[bi].second) {
	// 制約を満たすとき
	if (red[ri].second > my) {
	  // 最もbiが大きいものを選ぶ
	  my = red[ri].second;
	  mx = red[ri].first;
	  selectedRed = ri;
	  selectedBlue = bi;
	} else if (red[ri].second == my) {
	  // 同じ条件の点があったとき、よりaiが大きいものを選ぶ
	  if (red[ri].first > mx) {
	    my = red[ri].second;
	    mx = red[ri].first;
	    selectedRed = ri;
	    selectedBlue = bi;
	  }
	}
      }
    }
    if (my > -1) {
      // 制約を満たす点が見つかったとき
      // 選択した点をvectorから削除する
      red[selectedRed] = red.back();
      red.pop_back();
      blue[selectedBlue] = blue.back();
      blue.pop_back();
      sort(ALL(red), [](pair< int, int > x, pair< int, int > y) { return x.first < y.first; });
      sort(ALL(blue), [](pair< int, int > x, pair< int, int > y) { return x.first < y.first; });
      ans++;
      // biを削除してしまったので最初からまたやり直す
      bi = -1;
    }
  }

  cout << ans << endl;
  

  return 0;
}



Measured memory_bytes: 256
// ※※※ 解答不能 ※※※
// Um_nik氏
// https://atcoder.jp/contests/agc039/submissions/7870163
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 42;
bool A[N][N];
ll dp[N][N][N];
int n;
char s[N];

int main(){
    scanf("%d", &n);
    n *= 2;
    for(int i = 0; i < n; i++){
        scanf("%s", s);
        for(int j = 0; j < n; j++) A[i][j] = (s[j] == '1');
    }
    
/*
    n = 40;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            A[i][j] = 1;
*/
    for(int i = 0; i < n; i++) dp[i][i + 1][i] = 1;
    for(int len = 3; len < n; len += 2){
        for(int l = 0; l + len <= n; l++){
            int r = l + len;
            for(int m1 = l + 1; m1 < r; m1 += 2){
                for(int m2 = m1 + 1; m2 < r; m2 += 2){
                    ll w = 0;
                    for(int i = l; i < m1; i++){
                        for(int j = m2; j < r; j++){
                            if (!A[i][j]) continue;
                            w += dp[l][m1][i] * dp[m2][r][j];
                        }
                    }
                    for(int i = m1; i < m2; i++) dp[l][r][i] += w * dp[m1][m2][i];
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i < n; i++) if(A[0][i]) ans += dp[1][n][i];
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.Design;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<int> Slist() {
            var t = ReadLine();
            if (t.Trim().Length == 0) return new List<int>();
            return new List<int>(t.Split().Select(int.Parse)); }
        static void Main(string[] args)
        {
            var k = Sarray()[1];
            var hs = Sarray().OrderByDescending(x=>x).ToArray();
            long ans = 0;
            for(var i=k;i<hs.Length;i++)
            {
                ans += hs[i];
            }
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 46152
#include<stdio.h>

int main(void)
{
    int H, W, i, j;
    for (;;) {
        scanf("%d %d", &H, &W);
        if (H == 0 && W ==0) break;
        for (i=1; i<=H; i++) {
            for (j=1; j<=W; j++) {
                if (i == 1 || j == 1 || i == H || j == W) printf("#");
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
}



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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	std::sort(a, a + n);
	int res = 0;
	for (int i = 0; i < n; i++) {
		std::vector<int> all;
		int head = 0;
		int tail = 0;
		for (int j = 0; j < i; j++) {
			int upper = a[i] + a[j];
			int lower = a[i] - a[j];
			while (head < (int) all.size() && all[head] < upper) head++;
			while (tail < (int) all.size() && all[tail] <= lower) tail++;
			while (tail && all[tail - 1] > lower) tail--;
			res += head - tail;
			all.push_back(a[j]);
		}
	}
	printf("%d\n", res);
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    int x[5]; sca(x, 5);
    fo(i, 5) {
        if (!x[i]) {
            cout << i+1;
        }
    }
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int N=1e5+5;
//int a[N];
//int b[N];
char s[N];
char t[N];
ll f[N];
int cmp1(int a,int b)
{
    return b<a;
}
multiset<int> ss;
map<int,int>mp;
int main()
{
    int n;
    scanf("%d",&n);
    int a,b,c,d;
    a=b=c=d=0;
    for(int i=1;i<=n;i++){
        scanf("%s",s);
        if(s[0]=='A') a++;
        if(s[0]=='W') b++;
        if(s[0]=='T') c++;
        if(s[0]=='R') d++;
     }
     printf("AC x %d\n",a);
     printf("WA x %d\n",b);
     printf("TLE x %d\n",c);
     printf("RE x %d\n",d);
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
int n,ans,x,y,z;
int main(){
	//freopen("input.txt","r",stdin);
	scanf("%d",&n);
	for(int i = 0;i < n;i++){
		string s;
		cin >> s;
		if(s[0] == 'B' && s.back() == 'A')x++;
		else if(s[0] == 'B')y++;
		else if(s.back() == 'A')z++;
		for(int j = 0;j + 1 < s.size();j++)
			if(s[j] == 'A' && s[j + 1] == 'B')ans++;
	}
	ans+=max(0,x - 1);
	if(x)x = 1;
	if(x && y && z)ans+=2,y--,z--,x = 0;
	ans+=min(y,z);
	int temp = min(y,z);
	y-=temp;
	z-=temp;
	ans+=min(x,y);
	ans+=min(x,z);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MAX(a, b, c) max(max(a, b), c)
using namespace std;

int main(){
  int n,m;
  scanf("%d%d", &n, &m);
  int l_p = 0;
  int r_p = n+1; 
  REP(i,m){
    int l,r;
    scanf("%d%d",&l,&r);
    if(l_p < l) l_p = l;
    if(r < r_p) r_p = r;
  }
  if(l_p <= r_p) cout << r_p-l_p+1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int problem[105];
struct node
{
    int p,x;
}d[105];
int n,m,sum=0;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>problem[i];
        sum+=problem[i];
    }
    cin>>m;
    for(int i=1;i<=m;++i)
    {
        cin>>d[i].p>>d[i].x;
    }
    for(int i=1;i<=m;++i)
    {
        int t=sum;
        cout<<t-problem[d[i].p]+d[i].x<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        boolean Cfound=false;
        boolean Ffound=false;
        for(int i=0;i<line.length();i++){
        	if(Cfound){
        		if(line.charAt(i)=='F') Ffound=true;
        	}
        	else if(line.charAt(i)=='C') Cfound=true;
        }
        
        if(Ffound) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 8148
#include <stdio.h>
#define N 200000

int main() {

	int n,i,j,p[N],pi_min,p_MAX;

	scanf("%d",&n);

	for (i = 0; i < n; i++) scanf("%d", &p[i]);

	pi_min = p[0];

	for (i = 0; i < n-1; i++) {
		if (p[i] > pi_min) continue;

		else pi_min = p[i];

		for (j = i+1; j < n; j++) {
			if (i == 0 && j == 1) p_MAX = p[j] - p[i];	//最初の初期化	

			if (p_MAX < p[j] - p[i]) p_MAX = p[j] - p[i];
						
		}
		
	}

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

	return 0;

}


Measured memory_bytes: 2576
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {
    int x; 
    cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
//------------------------------------------------------------------//
typedef long long ll;
typedef vector<int> vi;
template <typename T> inline T read() {
	bool f = 1; T x = 0; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = !f;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	return f ? x : -x;
}
#define gi read<int>()
#define gl read<ll>()
//------------------------------------------------------------------//

const int N = 200020;
int n, A[N];
struct node {
	int a, b;
	node(int a = 0, int b = 0): a(a), b(b){}
	bool operator < (const node& rhs) const { return min(a, b) < min(rhs.a, rhs.b); }
};
int main() {
	n = gi;
	for (int i = 1; i <= n; ++i) A[i] = gi;
	ll ans = 0;
	sort (A + 1, A + n + 1, greater<int>());
	priority_queue <node> q;
	q.push(node(A[1], A[2]));
	q.push(node(A[2], A[1]));
	for (int i = 3; i <= n; ++i) {
		node cur = q.top();
		q.pop();
		ans += min(cur.a, cur.b);
		q.push(node(cur.a, A[i]));
		q.push(node(A[i], cur.b));
	}
	cout << ans + A[1] << '\n';
	return 0;
}


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

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

    string S;
    cin >> S;
    int ans = 700;
    for (int i = 0; i < 3; i++) if (S[i] == 'o') ans += 100;
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <string>

using std::cin;
using std::cout;
using std::endl;

using std::min;
using std::max;
using std::abs;

using std::string;
using std::to_string;

using std::vector;

int main(void) {
    vector<bool> t('z' + 1, false);
    string s;

    cin >> s;
    for(char c : s){
        t[c] = true;
    }

    char ans = '?';
    for(char c = 'a'; c <= 'z'; c++){
        if(!t[c]){
            ans = c;
            break;
        }
    }

    if(ans == '?'){
        cout << "None" << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}



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

int main(){

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

    string s;
    cin>>s;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R')cout<<3;
    else if(s[0]=='R'&&s[1]=='R'||s[1]=='R'&&s[2]=='R')cout<<2;
    else if(s[0]=='R'||s[1]=='R'||s[2]=='R')cout<<1;
    else cout<<0;

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int a[110];
int main()

{
	int n;
	cin>>n;
	for(int i=1;i<=2*n;i++)
	cin>>a[i];
	sort(a+1,a+1+2*n);
	int sum=0;
	for(int i=1;i<=2*n;i+=2)
	{
		sum=sum+a[i];
	}
	cout<<sum<<endl;
	return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            string[] ST = Console.ReadLine().Split(' ');
            string S = ST[0];
            string T = ST[1];

            string moji = "";

            for(int i = 0; i < N; i++)
            {

                moji = moji + S[i].ToString() + T[i].ToString();
            }

            Console.WriteLine(moji);
        }
    }
    
}


Measured memory_bytes: 13140
'use strict';
(function(input){
  input=input.trim().split('').sort();
  const ans=((input[0]!==input[1])?'No':
             (input[2]!==input[3])?'No':
             (input[0]===input[2])?'No':
             'Yes');
  console.log(ans);
})(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 21064
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;


signed main() {
int N,ans=0;
string S;
cin >> S;
if(S=="RRR"){
    ans=3;
}
if(S=="RRS"){
    ans=2;
}
if(S=="SRR"){
    ans=2;
}
if(S=="RSR"||S=="RSS"||S=="SRS"||S=="SSR"){
    ans=1;
}
if(S=="SSS"){
    ans=0;
}

answer(ans);
return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define lli long long int
#define f first
#define s second
#define fw(i, start, end) for (lli i = start; i < end; ++i)
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    lli n, W;
    cin >> n >> W;
    lli wi[n + 1], vi[n + 1], k[W + 1];
    memset(wi, 0, sizeof wi);
    memset(vi, 0, sizeof vi);
    memset(k, 0, sizeof k);
    fw(i, 1, n+1) cin >> wi[i] >> vi[i];
    fw(j, 1, n + 1)
    {
        lli w = wi[j], v = vi[j];
        for (lli i = W; i >= w; i--)
        {
            k[i] = max(k[i], k[i - w] + v);
        }
    }
    lli bst = 0;
    fw(i, 0, W+1)
    {
        bst = max(bst, k[i]);
    }

    cout << bst << endl;
    return 0;
}

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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n, k;
    cin >> n >> k;

    int dp[100] = {};
    long double sum = 0;
    for (int i = 1; i <= n; i++)
    {
        long double r = 1;
        for (int j = 0;; j++)
        {
            if (i * pow(2, j) >= k)
            {
                sum += r;
                break;
            }
            r *= 0.5;
        }
    }
    cout << setprecision(12) << sum * (1. / n) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int A,B; cin>>A>>B;
    if(A>=13){
        cout<<B;
    }
    else if((A>=6) && (A<=12) ){
        cout<<B/2;
    }
    else{
        cout<<0;
    }
    return 0;

}


Measured memory_bytes: 256