akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/rope>

using namespace __gnu_pbds; 
using namespace __gnu_cxx;
using namespace std;
using ll = long long;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define precision(n) fixed<<setprecision(n)

#ifdef LOCAL
    #include "debug.h"
#else
    #define debug(...) 42
#endif

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}

template<typename T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;
template<typename T> using MinPriorityQueue = priority_queue <T, vector <T>, greater <T> >;
template<typename T> void done(T ans) {cout << ans << "\n"; exit(0);}

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);

clock_t time_p=clock();
void printTime(){
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}
 

const int mod = 1e9 + 7;
const int N = 1e5 + 5;
int main(){
    io();
    ll n;
    cin >> n;
    vector<ll> v{1, 2, 3, 4, 5, 6, 7, 8, 9};
    for(ll i = 0; i < v.size(); i++) {
        int x = v[i] % 10;
        if(v.size() > n)  break;
        if(x > 0 and x < 9) {
            v.push_back(v[i] * 10 + x - 1);
            v.push_back(v[i] * 10 + x );
            v.push_back(v[i] * 10 + x + 1);
        }
        if(x == 0) {
            v.push_back(v[i] * 10 + x );
            v.push_back(v[i] * 10 + x + 1);   
        }
        if(x == 9) {
            v.push_back(v[i] * 10 + x - 1);
            v.push_back(v[i] * 10 + x );
        }
        // cout << v[i] << " ";
    }
    cout << v[n - 1];


}

Measured memory_bytes: 1592
import java.util.Scanner;

//Card Game is Fun
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt();
		int[] a = new int[A], b = new int[B];
		for(int i=0;i<A;i++)a[i] = sc.nextInt();
		for(int i=0;i<B;i++)b[i]=sc.nextInt();
		int res = 0;
		for(int i=0;i<B;i++){
			int v = i, p = 0, k = 0;
			while(v<B&&p<A){
				if(b[v]==a[p]){
					res = Math.max(res, ++k);
					v++;
				}
				p++;
			}
		}
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int main() {
  int n; cin >> n;
  vector<LL> t(n), a(n);
  for (int i = 0; i < n; i ++) cin >> t[i] >> a[i];

  LL T = 1, A = 1, m, x, y;
  for (int i = 0; i < n; i ++) {
    x = T / t[i];
    y = A / a[i];
    if (T % t[i] != 0) x ++;
    if (A % a[i] != 0) y ++;

    m = max(x, y);
    T = m * t[i];
    A = m * a[i];
  }

  cout << T + A << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	char n;
	map<char,char>tr;
	tr['A']='T';
	tr['T']='A';
	tr['C']='G';
	tr['G']='C';
	int ans=0;
	cin >>n;
	cout<<tr[n]<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] aegs) {
		Scanner sc=new Scanner(System.in);
		int kaisu=sc.nextInt();
		String moto="";
		int A=0;
		int Un=0;
		boolean checksum=true;
		boolean tp=true;
		for(int i=0; i<kaisu; i++) {
			moto=sc.next();

			if(moto.equals("A")) {
				A++;
			}
			else if(moto.equals("Un")) {
				Un++;
			}

			if(Un>A) {
				checksum=false;
				tp=false;
			}
		}

		if(A==Un && tp==true) {
			checksum=true;
		}
		else if(A!=Un && tp==true) {
			checksum=false;
		}

		if(checksum==true) {
			System.out.println("YES");
		}

		else if(checksum==false) {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 26392
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0


ans=0

n,m=LI()
if n==m:
    ans='Yes'
else:
    ans='No'
print(ans)


Measured memory_bytes: 39276
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
struct s{
	char a;
	int b;
};
s card1[100],card2[100];
void BubbleSort (int n){
	int i,j;
	for(i=0;i<n;i++){
		for(j=n-1;j>i;j--){
			if(card1[j].b<card1[j-1].b){
				swap(card1[j],card1[j-1]);
			}
		}
	}
	for(i=0;i<n;i++){
		if(i!=0){
			cout<<' ';
		}
		cout<<card1[i].a<<card1[i].b;
	}
	cout<<endl<<"Stable"<<endl;
}
void SelectionSort(int n){
	int minj,j,i,cut=0;
	for(i=0;i<n-1;i++){
		minj=i;
		for(j=i;j<n;j++){
			if(card2[j].b<card2[minj].b){
				minj=j;
			}
		}
		if(card2[i].b==card2[minj].b){
			cut++;
		}
		swap(card2[minj],card2[i]);
	}
	for(i=0;i<n;i++){
		if(i!=0){
			cout<<' ';
		}
		cout<<card2[i].a<<card2[i].b;
	}
	if(cut>1){
		cout<<endl<<"Not stable"<<endl;
	}
	else {
		cout<<endl<<"Stable"<<endl;
	}
}
int main(){
	int n,i,j;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>card1[i].a>>card1[i].b;
	}
	for(i=0;i<n;i++){
		card2[i]=card1[i];
	}
	BubbleSort (n);
	SelectionSort (n);
	return 0;
}
	

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

int main() { 
  ll N, M;
  cin >> N >> M;
  ll ans = 0;
  if (N < (M/2)) {
    ll c = M - 2 * N;
    ans = N + c/4;
  } else {
    ans = M/2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
if((s.at(5)=='0') && ((s.at(6)=='1') || (s.at(6)=='2') || (s.at(6)=='3') ||(s.at(6)=='4')))
cout << "Heisei" << endl;
else 
cout << "TBD" <<endl;
	
}

Measured memory_bytes: 256
require 'set'

class Graph
	def initialize
		@nodes = Set.new
		@edges = Set.new
	end

	def add_node(label = nil)
		Node.new(label)
	end

	def add_edge(u, v)
		e = Edge.new(u, v)
		u.outgoings << e
		v.incomings << e
		e
	end
	
	def del_edge(e)
		u, v = e.from, e.to
		u.outgoings.delete(e)
		v.incomings.delete(e)
		e
	end

	class Node
		def initialize(label)
			@label = label
			@outgoings = Set.new
			@incomings = Set.new
		end
		
		def to_s
			@label
		end
		attr_accessor :incomings, :outgoings
		attr_reader :label
	end

	class Edge
		def initialize(u, v)
			@from = u	
			@to = v
		end
		attr_reader :from, :to
	end

	def Graph::get_path_bfs(s, t)
		path_edge = {}
		reached = Set[s]
		queue = [s]
		while !queue.empty? 
			u = queue.shift
			u.outgoings.each{|e|
				v = e.to
				next if reached.include?(v)	
				reached << v
				queue << v
				path_edge[v] = e

				if v == t
					path = []
					while e = path_edge[v]
						path.unshift e
						v = e.from
					end
					return path
				end
			}
		end	
		return nil
	end

	def Graph::get_path_dfs(s, t, reached = Set.new)
		reached << s	
		s.outgoings.each{|e|
			v = e.to
			next if reached.include?(v)
			return [e] if v == t
			
			path = get_path_dfs(v, t, reached) 
			return [e] + path if path
		}
		nil
	end

	def Graph::reachable_from(s, reached = Set.new, root = true)
		reached << s	
		s.outgoings.each{|e|
			v = e.to
			next if reached.include?(v)
			reachable_from(v, reached, false) 
		}
		root ? reached : nil
	end
end

loop {
	n = gets.to_i
	break if n == 0

	schedule = (0..29).map{[]}
	(0..n-1).each{|member|
		gets.split(/\s+/).map(&:to_i)[1..-1].each{|day|
			schedule[day-1] << member
		}
	}

	g = Graph.new
	day_nodes = (0..29).map{|day|
		(0..n-1).map{|i| g.add_node(i)}
	}

	(0..29).each{|day|
		members = schedule[day]
		nodes = day_nodes[day]
		for i in 0..members.size-1
			u = nodes[members[i]]
			v = nodes[members[(i+1) % members.size]]
			g.add_edge(u,v)
		end
		if day > 0
			(0..n-1).each{|i|
				g.add_edge(nodes[i], day_nodes[day-1][i])
			}
		end
	}

	x_day = -1
	(0..29).each{|day|
		members = schedule[day]
		next if members.empty?
		s = day_nodes[day][members[0]]
		nodes = Graph::reachable_from(s)
		reached_index = Set.new
		nodes.each{|v| reached_index << v.label}
		if reached_index.size == n
			x_day = day + 1
			break
		end
	}
	puts x_day
}

Measured memory_bytes: 28596
def main():
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = list(input())
    score = {"r": p, "s": r, "p": s}
    answer = 0
    for i in range(n):
        if i < k:
            answer += score[t[i]]
            if i + k < n and t[i] == t[i + k]:
                t[i + k] = t[i + k] + "*"
        elif i + k < n:
            if "*" not in t[i]:
                answer += score[t[i][0]]
                if t[i][0] == t[i + k][0]:
                    t[i + k] = t[i + k] + "*"
        else:
            if "*" not in t[i]:
                answer += score[t[i][0]]
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 6708
int main(){int n,x,m[101],i,a=0,b=1001;scanf("%d%d",&n,&x);for(i=0;i<n;i++){scanf("%d",&m[i]);a=a+m[i];if(b>m[i])b=m[i];}printf("%d\n",n+(x-a)/b);}

Measured memory_bytes: 128
N = input()
A = map(int, raw_input().split())


A = [0] + A + [0]
total_sum = 0
for i in range(0, len(A) - 1):
    total_sum += abs(A[i + 1] - A[i])

for i in range(1, len(A) - 1):
    partial_sum = total_sum - abs(A[i + 1] - A[i]) - abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i - 1])
    print partial_sum



Measured memory_bytes: 11132
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        for(int i = 0; i<N; i++) {
            a[i] = sc.nextInt();
        }
        int i = 0;
        for(i = N-1; i>=0; i=i-2) {
            System.out.print(a[i] + " ");
        }
        for(i = (i==-2)?1:0 ; i<N-1; i=i+2) {
            System.out.print(a[i] + " ");
        }
        System.out.println();
    }
}

Measured memory_bytes: 93716
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA(My_College_Sucks)
*/
#include <bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define nl printf("\n")
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli, lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005

#define binary_search bs
#define lower_bound lb
#define upper_bound ub

lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
lli f(lli n,lli m)
{
    lli ans=inf,i;
    rep(i,1,n)
    {
        lli temp=i*m;
        lli rem=(n*m)-temp;
        lli temp1=(n-i)*(m/2);
        lli temp2=rem-temp1;
        lli mini=min(temp,min(temp1,temp2));
        lli maxi=max(temp,max(temp1,temp2));
        if((maxi-mini)<ans)
        {
            ans=maxi-mini;
        }
        temp1=m*((n-i)/2);
        temp2=rem-temp1;
        mini=min(temp,min(temp1,temp2));
        maxi=max(temp,max(temp1,temp2));
        if((maxi-mini)<ans)
        {
            ans=maxi-mini;
        }
    }
    return ans;
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    lli n,m;
    cin>>n>>m;
    if(n%3==0 or m%3==0)
    {
        cout<<0;
        exit(0);
    }
    lli ans=f(n,m);
    ans=min(ans,f(m,n));

    cout<<ans;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		int n = sc.nextInt();
		long l = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		int last = -1;
		for (int i = 0; i < n - 1; i++) {
			if (l <= a[i] + a[i + 1]) {
				last = i;
				break;
			}
		}
		if (0 <= last) {
			sb.append("Possible\n");
			for (int j = 0; j < last; j++) {
				sb.append((j + 1) + "\n");
			}
			for (int j = n - 2; last <= j; j--) {
				sb.append((j + 1) + "\n");
			}
			System.out.print(sb);
		} else {
			System.out.println("Impossible");
		}
	}

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


Measured memory_bytes: 24628
n = int(input())
target = float('inf')
ans = 0

for i in range(n):
    s = int(input())
    ans += s
    if str(s)[-1] != "0":
        target = min(target, s)

if ans % 10 != 0:
    print(ans)
elif ans % 10 == 0 and target == float('inf'):
    print(0)
else:
    print(ans - target)

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

using namespace std;

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

  if (a == 'H' && b == 'H') {
    cout << "H" << endl;
  } else if (a == 'H' && b == 'D') {
    cout << "D" << endl;
  } else if (a == 'D' && b == 'H') {
    cout << "D" << endl;
  } else {
    cout << "H" << endl;
  }
  return 0;
}

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

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

  int ans = 0;
  rep(i, n) {
    if(i >= 2 && s[i-2] == 'A' && s[i-1] == 'B' && s[i] == 'C') {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

long long P = 1000000007;

class C {
public:
  int n;
  vector<long long> fac, inv, facInv;

  long long power(long long e, long long x) {
    if (x == 0)
      return 1;
    if (x == 1)
      return e;
    if (x % 2 == 0)
      return power((e * e) % P, x / 2);
    return (e * power(e, x - 1)) % P;
  }

  C(int n_) {
    n = n_;
    fac.resize(n + 1);
    inv.resize(n + 1);
    facInv.resize(n + 1);
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= n; i++)
      fac[i] = (i * fac[i - 1]) % P;
    inv[0] = inv[1] = 1;
    for (int i = 2; i <= n; i++)
      inv[i] = power(i, P - 2);
    facInv[0] = facInv[1] = 1;
    for (int i = 2; i <= n; i++)
      facInv[i] = (inv[i] * facInv[i - 1]) % P;
  }

  long long comb(int N, int K) {
    if (N < K || K < 0 || N < 0)
      return 0;
    if (N == 0 || K == 0 || K == N)
      return 1;
    return ((fac[N] * facInv[K]) % P * facInv[N - K]) % P;
  }

  long long hcomb(int N, int K) {
    if (N == 0 && K == 0)
      return 1;
    return comb(N + K - 1, K);
  }

  long long mul(long long a, long long b) { return (a * b) % P; }

  long long add(long long a, long long b) { return (a + b) % P; }

  // find c
  // where a^c = b (mod P)
  long long dlp(long long a, long long b) {
    long long m = ceil(sqrt(P));
    map<long long, long long> mp;
    for (int i = 0; i < m; i++)
      mp[power(a, i)] = i;
    long long ainvm = power(power(a, m), P - 2);
    cout << m << endl;
    for (int i = 0; i < m; i++) {
      if (mp.find(b) != mp.end()) {
        return i * m + mp[b];
      }
      b = mul(b, ainvm);
    }
    return -1;
  }
};

C cmp(202020);
ll dp[202020][2] = {0};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll ans = 1;
  dp[0][0] = 1;
  ll t = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == 'B') {
      if (t % 2 == 0) {
        t++;
      } else {
        ans *= t;
        ans %= P;
        t--;
        if (ans == 0) {
          cout << 0 << endl;
          return 0;
        }
      }
    } else {
      if (t % 2 == 1) {
        t++;
      } else {
        ans *= t;
        ans %= P;
        t--;
        if (ans == 0) {
          cout << 0 << endl;
          return 0;
        }
      }
    }
  }
  if (t > 0) {
    cout << 0 << endl;
    return 0;
  }

  cout << (ans * cmp.fac[n]) % P << endl;
  return 0;
}


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

#define LL long long

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    string s; cin >> s; int ok = 0;
    sort(s.begin(), s.end());
    if(s[0] == s[1] && s[2] != s[0] && s[2] == s[3]) ok = 1;    
    cout << (ok ? "Yes" : "No");
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e8, cnt;


int main(){
	ll n;
	cin>>n;
	ll a[n],b[n];
	for(ll i=0; i<n; i++){
		cin>>a[i]>>b[i];
	}
	for(ll i=n-1; i>=0; i--){
		a[i] +=ans;
		if(a[i]%b[i]!=0){
			ll flag=(((a[i]/b[i])+1)*b[i])-a[i];
			ans +=flag;
		}
		
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N  =I.nextInt();
		long[] a = new long[N];
		for (int i = 0; i < N; i++) a[i]  =I.nextLong();
		int ptr = N-1;
		while (ptr>=0) {
			O.p(a[ptr]+" ");
			ptr-=2;
		}
		ptr=N%2;
		while (ptr<N) {
			O.p(a[ptr]+" ");
			ptr+=2;
		}
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}

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

#define DIV 1000000007

//高速べき乗(mod DIV)
long long mypow(long long k, long long n) {
	long long temp = 1;

	k = k % DIV;
	while (n) {
		if (n % 2) temp = temp * k % DIV;
		k = k * k % DIV;
		n = n / 2;
	}
	return temp % DIV;
}

//組み合わせ(mod DIV)
long long cmb(long long n, long long r) {
	long long x = 1, y = 1, y_inv;
	long long min;

	if (n - r > r) min = r;
	else min = n - r;
	for (long long i = 0; i < min; i++) {
		x = x * (n - i) % DIV;
		y = y * (i + 1) % DIV;
	}
	y_inv = mypow(y, DIV - 2);
	return x * y_inv % DIV;
}
int main(void) {
	long long x, y;
	long long a = -1, b = -1;
	long long ans = 0;

	scanf("%lld %lld", &x, &y);
	if (2 * y - x < 0 || 2 * x - y < 0) printf("0");
	else {
		if ((2 * y - x) % 3 == 0)a = (2 * y - x) / 3;
		if ((2 * x - y) % 3 == 0)b = (2 * x - y) / 3;

		if (a == -1 || b == -1)printf("0");
		else {
			ans = cmb(a + b, a);
			printf("%lld", ans);
		}
	}
	return 0;
}


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

int main(){
  	int a,b,ans=0;
  	cin >> a >> b;
  	if(a>=b){
    	for(int i=0;i<=a-1;i++){
        	ans += pow(10,i)*b;
        }
    }
  	else{
    	for(int i=0;i<=b-1;i++){
        	ans += pow(10,i)*a;
        }
    }
  	cout << to_string(ans);
	return 0;
}




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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int X, A;
    cin >> X >> A;
    if (X < A) cout << 0 << endl;
    else cout <<10 << endl;
  
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    if(n>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3616
/* Hello darkness my old friend, I've come to visit you again! */

#include<bits/stdc++.h>
#define lli long long int
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORB(i,b,a) for(i=b;i>=a;i--)
#define mod 1000000007
#define PI 2*acos(0.0)
#define gs getline(cin,s)
#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pb push_back
#define eb emplace_back
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 1000000005
#define INF 1000000000000000005
#define io ios_base::sync_with_stdio(0);
#define ff first
#define ss second
using namespace std;

int main()
{
    io;
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    if(n<=999)
        cout<<"ABC";
    else
        cout<<"ABD";
    return 0;
}

/* This is the end, beautiful friend! */


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

int main() {
	int N;
	string S;

	cin >> N >> S;
	int x = 0;
	int max = 0;
	for(int i = 0; i < N; i++) {
		if(S[i] == 'I') {
			x++;
			if(max < x) {
				max = x;
			}
		} else {
			x--;
		}
	}

	cout << max << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<utility>
#define MP(a,b) make_pair(a,b)
using namespace std;

set<pair<int,int> > a,b;
bool ok(int dx,int dy){
	set<pair<int,int> >::iterator it;
	for(it=a.begin();it!=a.end();++it){
		if(b.find(MP(dx+it->first,dy+it->second)) == b.end())return false;	
	}
	return true;
}
int main(){
	int m,n;
	while(cin>>m,m){
		int x,y;
		a.clear();
		b.clear();
		for(int i=0;i<m;i++){
			cin>>x>>y;
			a.insert(MP(x,y));
		}
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>x>>y;
			b.insert(MP(x,y));
		}
		int dx,dy;
		set<pair<int,int> >::iterator it1,it2;
		for(it1=a.begin();it1!=a.end();++it1){
			for(it2=b.begin();it2!=b.end();++it2){
				dx=it2->first - it1->first;
				dy=it2->second - it1->second;
				if(ok(dx, dy)){
					goto BREAK;
				}
			}
		}BREAK:
		cout<<dx<<' '<<dy<<endl;
	}
	return 0;
}

Measured memory_bytes: 1252
#include<stdio.h>
int main()
{
	int n,a,i,r;
	while(1){
		r=0;
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=0;i<n;i+=4){
			scanf("%d",&a);
			r+=a;
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 2536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a));
    int ans = a[n-1] - a[0];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define ite ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
string itos(int a){
  string out;
  if(a==0)out="0";
  while(a){
    out=(char)(a%10+'0')+out;
    a/=10;
  }
  return out;
}
int main(){
  vector<int>v;
  map<string,int>m1,m2;
  string s;
  while(getline(cin,s),s!=""){
    long long int a[2]={0};
    string b;
    int i=0;
    while(s[i]!=','){a[0]*=10;a[0]+=s[i]-'0';i++;}
    b=itos(a[0]);
    //i++;
    //while(i!=s.size()){a[1]*=10;a[1]+=s[i]-'0';i++;}
    m1[b]++;
    v.pb(a[0]);
  }
  while(cin>>s){
    long long int a[2]={0};
    int i=0;
    string b;
    while(s[i]!=','){a[0]*=10;a[0]+=s[i]-'0';i++;}
    b=itos(a[0]);
    //i++;
    //while(i!=s.size()){a[1]*=10;a[1]+=s[i]-'0';i++;}
    m2[b]++;
  }
  sort(all(v));
  int i=0,c=-1;
  rep(i,v.size()){
    string tmp=itos(v[i]);
    if(c==v[i])continue;
    else c=v[i];
  //for(map<string,int>ite it=m1.begin();it!=m1.end();it++){
    //cout<<"!"<<endl;
    //if(m2[it->first]!=0)cout<<it->first<<" "<<it->second+m2[it->first]<<endl;
    if(m2[tmp]!=0)cout<<v[i]<<" "<<m1[tmp]+m2[tmp]<<endl;
  }
}

Measured memory_bytes: 1224
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,x;
	cin>>n>>x;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	int sum=0;
	for(int i=0;i<x;i++){
		sum=sum+arr[i];
	}
	cout<<sum;
	return 0;
}

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

int main() {
    string S, T; cin >> S >> T;

    int x = 0;
    rep(i, S.size()){
        if (S[i] != T[i]){
            x = 1;
            break;
        }
    }

    if (x == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cout((n >= 1000) ? "ABD" : "ABC");
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL N; std::cin >> N;
  LL count = 1e14;

  for (LL i = 1; i*i<=N; ++i) {
    if (N%i == 0) {
      LL j = N/i;
      count = std::min(count, i + j - 2);
    }
  }

  std::cout << count << std::endl;
}


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

int main() {
  int n;
  cin >> n;
  double x;
  if(n%2==0)x=0.5;
  else{
    (double)n;
    x=(n+1+1.1-1.1)/(2*n);
  }
  cout << x << endl;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) ;
#define DEBUG(x) std::cerr << #x << " : " << (x) << std::endl;

int dx[4]{0, 1, 0, -1};
int dy[4]{1, 0, -1, 0};



int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll N, K; cin >> N >> K;

	vector<ll> A(N); REP(i, N) cin >> A[i], --A[i];

	ll logK = 1;
	while ((1ll << logK) < K) logK++;

	vector<vector<ll>> doubling(logK, vector<ll>(N));
	REP(i, N)
		doubling[0][i] = A[i];

	REP(k, logK-1)
	{
		REP(i, N)
		{
			doubling[k+1][i] = doubling[k][doubling[k][i]];
		}
	}

	ll now{0};
	for (ll k = 0; ; ++k)
	{
		if (K & 1) now = doubling[k][now];
		K = K >> 1;
		if (K == 0) break;
	}

	std::cout << now + 1 << std::endl;
	return 0;
}


Measured memory_bytes: 100080
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;

int main(){
	int n; cin>>n;
	int ans=0;
	int t=1;
	int b; cin>>b;
	FOR(i,1,n){
		int a; cin>>a;
		if(a!=b){
			ans+=t/2;
			t=1;
		}else{
			t++;
		}
		b=a;
	}
	ans+=t/2;
	co(ans);
}

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

long long  n;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n;
    int m = sqrt(n + 0.5);
    long long ans = 0;
    for (int i = 1; i <= m; i++){
        if(n%i == 0 &&(n/i)-1>i){
            ans += n/i-1;
        }
    }
    
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    cout << 100 << " " << 100 << "\n";
	
	int pt = b-1;
	rep(i, 50) {
		rep(j, 100) {
			if(i%2 == 0 && j%2 == 0 && pt > 0) {
                cout << '#';
                pt--;
            }
			else {
                cout << '.';
            }
		}
		cout << "\n";
	}

	pt = a-1;
	rep(i, 50) {
		rep(j, 100) {
			if(i%2 == 1 && j%2 == 0 && pt > 0) {
                cout << '.';
                pt--;
            }
			else {
                cout << '#';
            } 
		}
		cout << "\n";
	}
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	vector<int> heights;
	for (int i = 0; i < 10; ++i) {
		int h;
		cin >> h;
		heights.push_back(h);
	}

	sort(heights.begin(), heights.end(), std::greater<int>());
	for (int i = 0; i < 3; ++i) {
		cout << heights[i] << "\n";
	}
    return 0;
}

Measured memory_bytes: 1216
#include<cstdio>
using namespace std;
char s[3412];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            scanf("%s",s);//一个字符串
            if(s[0]=='s'&&s[1]=='n'&&s[2]=='u'&&s[3]=='k'&&s[4]=='e')//其实可以用cmp比较，但是只有五个字符，蒟蒻就一个一个比了。。。
            {
                printf("%c%d\n",'A'+j-1,i);//把列数转化为大写字母，行数直接打印

            }
        }
    }
    return 0;
} 

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

using namespace std;

#define int long long
#define all(a) a.begin(), a.end()
#define sz(x) ((int)x.size())
#define ff first
#define ss second
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<string> vs;
typedef map<int, int> mii;
typedef map<char, int> mci;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
template <class T>
istream &operator>>(istream &in, vector<T> &arr)
{
    for (auto &x : arr)
        in >> x;
    return in;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int n = s.length(), m = t.length();
    vvi dp(n + 1, vi(m + 1));
    dp[0][0] = 0;

    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= m; ++j)
        {
            if (s[i - 1] == t[j - 1])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    string ans;
    int i = n, j = m;
    while(j > 0 && i > 0){
        if(dp[i][j] == dp[i-1][j-1] + 1 && dp[i-1][j-1] >= dp[i-1][j] && dp[i-1][j-1] >= dp[i][j-1]){
            --i,--j;
            ans.push_back(s[i]);
        }else{
            if(dp[i-1][j] > dp[i][j-1]){
                --i;
            }else{
                --j;
            }
        }
    }
    reverse(all(ans));
    cout << ans;
}

Measured memory_bytes: 70784
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
int main() {
	int n;
	cin >> n;
	map<int, long long> mp;
	int a[n];
	for (int i = 0; i < n; i++){
		cin >> a[i];
		mp[a[i]]++;
	}

	long long res = 0;
	for (auto x : mp){
		res += (x.second-1)*(x.second) / 2;
	}
	for (int i = 0; i < n; i++){
		cout << res-mp[a[i]]+1 << endl;
	}

			
}


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

#define INF_LL (int64_t)1e18
#define INF (int32_t)1e9

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  
  for (auto &&e : A) cin >> e;
  
  set<int> st(A.begin(), A.end());
  
  if (st.size() == N) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 10368
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let xs: Vec<i64> = (0..n).map(|_| sc.cin()).collect();
    let mut x = (0..n).map(|i| if i % 2 == 0 { 1 } else { -1 } * xs[i]).sum();
    let mut ans = vec![0; n];
    for i in 0..n {
        ans[i] = x;
        x = -x + 2 * xs[i % n];
    }
    put!(..ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

const int dx[8] = {-1, 0, 1,-1,1,-1,0,1};
const int dy[8] = {-1,-1,-1, 0,0, 1,1,1};

int main(){
    int h, w; cin >> h >> w;
    vector<string> maze(h);
    rep(i,h) cin >> maze[i];
    rep(i,h)rep(j,w){
        if(maze[i][j]=='#') continue;
        int count = 0;
        rep(dir,8){
            int ni = i + dx[dir];
            int nj = j + dy[dir];
            if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if(maze[ni][nj]=='#') count++;
        }
        maze[i][j] = char(count+'0');//??
    }
    rep(i,h)cout << maze[i] << endl;
}

Measured memory_bytes: 256
def main():
    s = int(input())
    for i in range(s,s+100):
        x = 2
        is_prime = True
        while x * x <= i:
            if i % x == 0:
                is_prime = False
                break
            x += 1
        if is_prime:
            print(i)
            return

main()

Measured memory_bytes: 2940
#すぬけくんはレストランに通うのが好きです。
#すぬけくん行きつけのレストランは何を食べても 1 食 800 円で、15 食食べる毎にその場で 200 円もらえます。
#すぬけくんは今までで合計 N 食食べました。 今までに払った金額を x 円、レストランからもらった金額を y 円として、x−y を求めなさい。

N = int(input())
x = N * 800
y = int(N / 15) * 200
print(x-y)

Measured memory_bytes: 38384
use std::io::Read;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i32 = read();
    let m: usize = read();
    let s: Vec<Vec<usize>> = (0..m).map(|_| {
        let k: usize = read();
        (0..k).map(|_| {read::<usize>() - 1}).collect()
    }).collect();
    let p: Vec<i32> = (0..m).map(|_| read()).collect();

    let mut ret = 0;
    for set in 0..2i32.pow(n as u32) {
        let mut set_ = set.clone();
        let mut bits = vec![];
        for _ in 0..n {
            bits.push(set_ % 2);
            set_ /= 2;
        }
        let mut flag = true;
        for i in 0..m {
            let cnt: i32 = s[i].iter().map(|&e| bits[e]).sum();
            if cnt % 2 != p[i] {
                flag = false;
                break
            }
        }
        if flag {
            ret += 1;
        }
    }

    println!("{}", ret);
}


Measured memory_bytes: 2156
n,q = gets.split.map(&:to_i)
s = gets.chomp
sums = Array.new(n+1,0)
(n-1).times do |i|
    if s[i,2] == "AC"
        sums[i+1] += 1
    end
end
n.times do |i|
    sums[i+1] += sums[i]
end
q.times do
    l,r = gets.split.map(&:to_i)
    ans = sums[r]-sums[l-1]
    ans -= 1 if s[r-1,2] == "AC"
    puts ans
end

Measured memory_bytes: 3324
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N,A,B,C;

	scanf("%d %d %d %d",&N,&A,&B,&C);

	printf("%d\n",N-((A+B)-C));

	return 0;
}



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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int r, c;cin >> r >> c;
    vector<vector<int>> hoge(r + 1, vector<int>(c + 1, 0));
    for (int i = 0; i < r; i++){
        for (int a = 0; a < c; a++){
            cin >> hoge[i][a];
        }
    }

    // c + 1の計算
    int c_sum = 0;
    for (int i = 0; i < r; i++){
        for (int a = 0; a < c; a++){
            c_sum += hoge[i][a];
        }
        hoge[i][c] = c_sum;
        c_sum = 0;
    }

    // r + 1の計算
    int r_sum = 0;
    for (int i = 0; i < c + 1; i++){
        for (int a = 0; a < r; a++){
            r_sum += hoge[a][i];
        }
        hoge[r][i] = r_sum;
        r_sum = 0;
    }

    // 結果
    for (int i = 0; i < r + 1; i++){
        for (int a = 0; a < c + 1; a++){
            cout << hoge[i][a];
            if (a != c){
                cout << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3132
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define fi first
#define se second 
#define pb push_back
#define sci(x) scanf("%d",&(x))
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
const int N=1e5+10,M=1e6+10,INF=0x3f3f3f3f,mod=1e9+7;//998244353
int n,m,k,a[N],b[N],c[N],x,y,d,e,f,ans;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	x=y=ans=INF;
	rep(i,1,n){
		scanf("%d",&a[i]);
		x=min(x,a[i]);
	}
	rep(j,1,m){
		scanf("%d",&b[j]);
		y=min(y,b[j]);
	}
	ans=min(ans,x+y);
	rep(i,1,k){
		scanf("%d%d%d",&d,&e,&f);
		ans=min(ans,a[d]+b[e]-f);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

#include <string>
using namespace std;
int main()
{
	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: 3596