akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
using namespace std;

int h, w;

int max(string s[], int x, int y) {
	queue <int> q;
	int max=-1;
	int dist[405];
	for (int i = 0; i < h*w;i++) {
		dist[i] = -1;
	}
	dist[y * w + x] = 0;
	if (x > 0) {
		if (s[y][x-1] == '.') {
			q.push(x - 1 + y * w);
			dist[x - 1 + y * w] = dist[y * w + x] + 1;
		}
	}
	if (x <w-1) {
		if (s[y][x+1] == '.') {
			q.push(x + 1 + y * w);
			dist[x + 1 + y * w] = dist[y * w + x] + 1;
		}
	}
	if (y > 0) {
		if (s[y-1][x] == '.') {
			q.push(x + (y - 1) * w);
			dist[x  + (y-1) * w] = dist[y * w + x] + 1;
		}
	}
	if (y < h - 1) {
		if (s[y+1][x] == '.') { 
			q.push(x + (y + 1) * w); 
			dist[x + (y + 1) * w] = dist[y * w + x] + 1;
		}
	}
	while (!q.empty()) {
		int p = q.front(); q.pop();
		if (p % w > 0) {
			if (s[p / w][p % w - 1] == '.' && dist[p - 1] == -1) {
				q.push(p - 1);
				dist[p - 1] = dist[p] + 1;
			}
		}
		if (p % w < w-1) {
			if (s[p / w ][p % w + 1] == '.' && dist[p + 1] == -1) {
				q.push(p + 1);
				dist[p + 1] = dist[p] + 1;
			}
		}
		if (p / w > 0) {
			if (s[p / w - 1][p % w ]== '.' && dist[p - w] == -1) {
				q.push(p - w);
				dist[p - w] = dist[p] + 1;
			}
		}
		if (p / w <h-1) {
			if (s[p / w + 1][p % w ]== '.' && dist[p +w] == -1) {
				q.push(p + w);
				dist[p + w] = dist[p] + 1;
			}
		}
	}
	for (int i = 0; i < h * w; i++) {
		if (max < dist[i]) max = dist[i];
	}
	return max;
}

int main(){
	int ans = -1;
	string  s[20];
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '.') {
				int t = max(s, j, i);
				if (ans < t) ans = t;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long int
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 100000000000
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp);
void ipgraph(int m);
const int mod = 1000000007;
const int N = 1e5+5, M = N;
//=========================================

int weight[105], value[105];
int dp[N];

int knapsack(int n, int W){

    memset(dp, 0, sizeof(dp));

    for(int i = 0; i < n; ++i){
        for(int j = W; j >= weight[i]; --j)
            dp[j] = max(dp[j], value[i] + dp[j - weight[i]]);
    }

    return dp[W];
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
    int n, W;
    cin >> n >> W;

    for(int i = 0; i < n; ++i)
        cin >> weight[i] >> value[i];


    int ans = knapsack(n, W);

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


Measured memory_bytes: 1024
#include <stdio.h>
int insertionSort(int *arr, int n, int g) {
  int count = 0;
  for (int i = g; i < n; i++) {
    int v = arr[i];
    int j = i - g;
    while (j >= 0 && arr[j] > v) {
      arr[j+g] = arr[j];
      j -= g;
      count++;
    }
    arr[j+g] = v;
  }
  return count;
}
int shellSort(int *arr, int n) {
  int count = 0,m = 0;
  for (int i = 1; i < n; i = i*3+1) m++;
  if (m < 1) m = 1;
  int nums[m] = {1};
  printf("%d\n", m);
  for (int i = 1; i < n; i = i*3 + 1) nums[count++] = i;
  count = 0;
  for (int i = m-1; i >= 0; i-=1) {
    printf("%d", nums[i]);
    if (i == 0) printf("\n");
    else printf(" ");
    count += insertionSort(arr,n,nums[i]);
  }
  return count;
}
int main() {
  int n, count=0;
  scanf("%d", &n);
  int arr[n];
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  count = shellSort(arr,n);
  printf("%d\n", count);
  for (int i = 0; i < n; i++) printf("%d\n", arr[i]);
  return 0;
}



Measured memory_bytes: 6568
//Code By CXY07
#include<bits/stdc++.h>
using namespace std;

//#define int long long

const int MAXN = 1;
const int INF = 2e9;
const int mod = 1e9 + 7;

int n;
char s[7];

signed main () {
	cin >> s + 1;
	puts((s[3] == s[4] && s[5] == s[6]) ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
fun main(args:Array<String>?): Unit {
    val primes = primesUnder(102_000)
    while(true){
        val (n, p) = readLine()!!.trim().split(' ').map(String::toInt)
        if (n == -1) return
        val upper = upperBound(primes, n)
        val nextPair = IntArray(p){it}
        repeat(p - 1){
            (nextPair.indices).minBy{primes[it + upper] + primes[nextPair[it] + upper]}!!.let{
                nextPair[it]++
            }
        }
        println(nextPair.indices.map { primes[it + upper] + primes[nextPair[it] + upper] }.min())
    }
}
fun primesUnder(upperLimit: Int): IntArray {
    val isPrime = BooleanArray(upperLimit + 1){true}
    for (p in 2 .. Math.sqrt(upperLimit.toDouble()).toInt()) if (isPrime[p]){
        for (j in p * p .. upperLimit step p){
            isPrime[j] = false
        }
    }
    return (2 .. upperLimit).filter(isPrime::get).toIntArray()
}
fun upperBound(array: IntArray, target: Int): Int {
    var left = 0
    var right = array.size
    while(left < right){
        val mid = (left + right) / 2
        if (array[mid] <= target) left = mid + 1
        else right = mid
    }
    return right
}


Measured memory_bytes: 44652
#include<bits/stdc++.h>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define vi vector<int> 
typedef long long ll;
using namespace std;
     
int main(){
    	int N;
    	cin >> N;
    	vi A(N), L(N+1,0), R(N+1,0);
    	REP(i,N){
    		cin >> A[i];
    	}
    	REP(i,N){
    		L[i + 1] = __gcd(L[i], A[i]);
    	}
    	for(int i = N - 1; i >= 0; i--){
    		R[i] = __gcd(R[i + 1], A[i]);
    	}
    	int ans = 0;
    	REP(i,N){
    		ans = max(ans, __gcd(L[i], R[i + 1]));
    	}
    	cout<<ans<<endl;
    	return 0;
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int res = 0;
  for (int i = 0, j = s.size() - 1; i < j;)
  {
    if (s[i] == s[j])
    {
      i++;
      j--;
    }
    else if (s[i] == 'x')
    {
      res++;
      i++;
    }
    else if (s[j] == 'x')
    {
      res++;
      j--;
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 512
package main

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

func main() {
	a, b, k := readInt(), readInt(), readInt()
	g := gcd(a, b)
	m := int(math.Sqrt(float64(g)))
	divisors := make([]int, 0)
	for i := 1; i <= m; i++ {
		if g%i == 0 {
			if g/i != i {
				divisors = append(divisors, g/i)
			}
			divisors = append(divisors, i)
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(divisors)))

	fmt.Println(divisors[k-1])
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define PI acos(-1LL)


#ifdef LOCAL
string to_string(const string& s){
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v){
    bool first = true;
    string res = "{";
    for(const auto& x: v){
        if(!first) res+=", ";
        first = false;
        res+=to_string(x);
    }
    res+="}";
    return res;
}
void bug() { cerr << endl; }
template<typename Head, typename... Tail>
void bug(Head H, Tail... T) {
    cerr << " " << to_string(H);
    bug(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__);
#else
#define debug(...) 11
#endif


const int M = 1000000007;
const int N = 2e6 + 5;
const long long INF = 2e9 + 12;


void solve(){
    string s;
    cin >> s;
    int r = 0, mx = 0;
    for(char c : s){
        if(c == 'R') r++;
        else
        {
            mx = max(mx, r);
            r = 0;
        }
    }
    mx = max(mx, r);
    cout << mx << endl;
}
signed main(){
    FAST
#ifdef LOCAL
    clock_t start;
    double duration;
    start = clock();
#endif
    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        solve();
    }
#ifdef LOCAL
    duration = (clock() - start) / (double) CLOCKS_PER_SEC;
    cerr <<"\nTotal time elapsed: "<< duration <<"sec\n";
#endif
}

Measured memory_bytes: 3644
using System;
using System.Linq;

namespace ABC143A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var A = input[0];
            var B = input[1];

            Console.WriteLine(Math.Max(A - B * 2, 0));
        }
    }
}

Measured memory_bytes: 11348
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll N;
    in >> N;
    vector<ll> A(N);
    map<ll, ll> counts{};
    REP(i, N) {
        in >> A[i];
        counts[A[i]]++;
    }
    ll S = 0;
    for(auto p: counts) {
        auto a = p.second;
        S += a * (a-1) / 2;
    }
    REP(i, N) {
        auto a = counts[A[i]];
        out << S - a*(a-1)/2 + (a-1)* (a-2)/2 << endl;
    }
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 11008
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef unsigned long long ULL;
ULL N, w;
ULL W[105];
ULL Value[105];
ULL f[200000];
inline ULL max(ULL x, ULL y) {
	return x > y ? x : y;
}
int main() {
	cin >> N >> w;
	ULL ans = 0;
	for (ULL i = 1; i <= N; i++)
		cin >> W[i] >> Value[i];
	memset(f, 0, sizeof(f));
	for (ULL i = 1; i <= N; i++)
		for (ULL j = w; j >= W[i]; j--)
			f[j] = max(f[j], f[j - W[i]] + Value[i]);
	cout << f[w];
	return 0;
}

Measured memory_bytes: 2040
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;

int main(){
    int n=0,m=0,p=0,Asum=0,Nsum=0;
    string s;
    map<int,int>  res;
    set<int>      solved;
    cin >> n>>m ;
    while(m--){
        cin >> p >> s;
        if(s == "WA"){
            res[p]++;
        }else if(s=="AC" && solved.count(p) == 0){
                // First AC
                solved.insert(p);
                Nsum+=res[p];
        }
    }

    cout << solved.size() << " " << Nsum<< endl;
    return 0;
}


Measured memory_bytes: 9600
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())
    S = [input() for _ in range(N)]
    S = Counter(S)
    print("AC x {}".format(S["AC"]))
    print("WA x {}".format(S["WA"]))
    print("TLE x {}".format(S["TLE"]))
    print("RE x {}".format(S["RE"]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 78704
from collections import defaultdict

# len = x となるか
def len_is_x(x):
    string = defaultdict(int)
    for i in range(x,N-x+1):
        string[S[i:i+x]] += 1
    for i in range(N-x+1):
        if i - x >= 0:
            string[S[i-x:i]] += 1
        if string[S[i:i+x]] >= 1:
            return True
        if i + x*2 <= N:
            string[S[i+x:i+x*2]] = max(string[S[i+x:i+x*2]]-1, 0) 
    return False

N = int(input())
S = input()

# lenのokとng
ng = N // 2 + 1
ok = 0

while (ng - ok) != 1:
    mid = (ok + ng) // 2
    if len_is_x(mid):
        ok = mid
    else:
        ng = mid

print(ok)

Measured memory_bytes: 9732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < t.size(); i++){
        for(int j = 0; j < s.size(); j++){
            if(t[i] > s[j]){
                cout << "Yes";
                return 0;
            }
        }
    }
    for(int i = 0; i < min(t.size(), s.size()); i++) if(s[i] != t[i]){
        cout << "No";
        return 0;
    }
    if(s.size() < t.size()) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}
int main() {
	lli n, temp, ans = 0, mans = 0;
	cin >> n;
	vector<lli>vec(n);
	rep0(i, n) {
		cin >> vec[i];
		vec[i] -= i + 1;
		if (vec[i]> 0)ans += vec[i];
		else mans -= vec[i];
	}
	sort(all(vec));
	lli ans_t = vec[n / 2];
	ans = 0;
	rep0(i, n)ans += abs(vec[i] - ans_t);

	cout << ans;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,c,i,cnt;
	scanf("%d %d %d",&a,&b,&c);
	cnt=0;
	i=1;
	while(1){
		cnt+=a;
		if(i%7==0){
			cnt+=b;
		}
		if(cnt>=c){
			break;
		}
		i++;
	}
	printf("%d\n",i);
	return 0;
}


Measured memory_bytes: 2752
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

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

        vector<ll> p(a), q(b), r(c);
        REP(i, a) cin >> p[i];
        REP(i, b) cin >> q[i];
        REP(i, c) cin >> r[i];

        sort(p.begin(), p.end(), greater<ll>());
        sort(q.begin(), q.end(), greater<ll>());
        sort(r.begin(), r.end(), greater<ll>());

        priority_queue<ll> pq;
        REP(i, x) pq.push(p[i]);
        REP(i, y) pq.push(q[i]);
        REP(i, c) pq.push(r[i]);

        ll ans = 0;
        REP(i, x + y) {
                ans += pq.top();
                pq.pop();
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 8432
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define F first
#define S second


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a > b)swap(a, b);
	if (b > c)swap(b, c);
	if (a > b)swap(a, b);
	cout << a << " " << c << endl;
}


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

int main()
{
	int a, b;

	string s;

	cin >> a >> b >> s;

	for (int i = 0; i < a; i++)
	{
		if (s[i]<'0' || s[i]>'9')
		{
			cout << "No" << endl;
			return 0;
		}
	}
	
	for (int i = a + 1; i < a + b + 1; i++)
	{
		if (s[i]<'0' || s[i]>'9')
		{
			cout << "No" << endl;
			return 0;
		}
	}

	if (s[a] == '-') cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;

char str[205][205];

int n;
int vis[205],dfs_cnt;
int col[205];

void dfs(int x) {
  vis[x]=dfs_cnt;
  for(int i=1;i<=n;i++)
    if (str[x][i]=='1') {
    	if (!vis[i]) {
    		col[i]=col[x]^1;
    		dfs(i);
		}
		else if (col[x]==col[i]) {
			puts("-1");
			exit(0);
		}
	}
}

queue <int> q;
int dis[205];

int bfs(int x) {
  memset(dis,0,sizeof(dis));
  q.push(x);
  dis[x]=1;
  int ans=1;
  while (!q.empty()) {
  	int x=q.front();q.pop();
  	for(int i=1;i<=n;i++)
  	  if (str[x][i]=='1'&&!dis[i]) {
  	  	  dis[i]=dis[x]+1;
  	  	  ans=max(ans,dis[i]);
  	  	  q.push(i);
		}
  }
  return ans;
}

int maxn[205];

int main() {
  scanf("%d",&n);
  for(int i=1;i<=n;i++) scanf("%s",str[i]+1);
  for(int i=1;i<=n;i++)
    if (!vis[i]) {
    	dfs_cnt++;
    	dfs(i);
	}
  for(int i=1;i<=n;i++) maxn[vis[i]]=max(maxn[vis[i]],bfs(i));
  int ans=0;
  for(int i=1;i<=dfs_cnt;i++) ans+=maxn[i];
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ms(x, n) memset(x,n,sizeof(x));
typedef  long long LL;
const int inf = 1<<30;
const LL maxn = 45;

int N, pre[maxn], in[maxn], post[maxn];
int postPos = 1, prePos = 1;
void rec(int l, int r){
    if(l >= r) return;
    //pre的下一个节点
    int c = pre[prePos++], m;
    //c在in中的位置
    for(int i = 1; i <= N; i++)
        if(in[i] == c){
            m = i; break;
        }
    rec(l, m);  //重建左子树
    rec(m+1, r);//重建右子树
    post[postPos++] = c;
}
int main()
{
    cin >> N;
    for(int i = 1; i <= N; i++)
        cin >> pre[i];
    for(int i = 1; i <= N; i++)
        cin >> in[i];

    rec(1, N+1);//右边界要略大一点
    cout << post[1];
    for(int i = 2 ; i <= N; i++)
        cout << " " << post[i];
    cout << endl;
	return 0;
}




Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int ans = (int) (a + Math.pow(a, 2) + Math.pow(a, 3));
		System.out.println(ans);
	}
}


Measured memory_bytes: 35636
#入力
N = int(input())
v = list(map(int,input().split()))
#小さい数順に並び替え
V = sorted(v)
#合計値をsumとする
sum = 0
#手で解いてみると、数が大きいものほど後から足した方が合計が大きいことが分かる。
if N >= 3:
  for i in range(N-1):
    sum += (2**(i))*V[i+1]/2**(N-1)
  sum += V[0]/2**(N-1)
#わざわざ場合分けしたがN>=3の時でもV[0]項を最後に分けて足しているので不要だったか?
elif N == 2:
  sum = (V[0]+V[1])/2
#結果
print(sum)

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 n;
  cin >> n;
  vector<int64> a(n);
  REP(i,n){
    cin >> a[i];
  }
  int64 ans = 0;
  int64 prevans = 0;
  while(true){
    int64 asum = 0;
    REP(i,n)asum += a[i] / n;
    REP(i,n){
      int64 x = a[i] / n;
      x = max<int64>(0,x);
      ans += x;
      a[i] -= x * n;
      a[i] -= x;
    }
    // ANS(ans);
    REP(i,n){
      a[i] += ans - prevans;
      // cout << a[i] << " ";
    }
    // cout << endl;
    prevans = ans;
    bool flg = true;
    REP(i,n){
      if(a[i] >= n){
        flg = false;
        break;
      }
    }
    if(flg)break;
  }
  ANS(ans);
  return 0;
}

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

int main() {
	int a,b;

	std::cin >>a>>b;
if(a>b)
	std::cout << "a > b" <<std::endl;
	else if(a<b)
	std::cout << "a < b" <<std::endl;
	else
		std::cout << "a == b" <<std::endl;
	return 0;
}

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


int main() 
{
    char S[4];
    scanf("%s", &S[0]);

    char T[4];
    scanf("%s", &T[0]);

    int i;
    int good = 0;
    for (i = 0; i < 3; i++) {
        if (S[i] == T[i]) {
            good++;
        }
    }
    printf("%d", good);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x,y;
int main()
{
	long long n,d;
	cin>>n>>d;
	int ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		if(x*x+y*y<=d*d)
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3676
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
const int IINF = 1e9;
const ll INF = 1e18;
const int MOD = 1e9 + 7;

#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl

void chmin(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
}
void chmax(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
}

bool isPalindrom(string s) {
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != s[s.length() - 1 - i]) return false;
  }
  return true;
}
int main() {
  string s;
  cin >> s;

  // dump(s.substr(0, (s.length() - 1) / 2));
  // dump(s.substr((s.length() - 1 + 3) / 2));
  bool result = isPalindrom(s) &&
                isPalindrom(s.substr(0, (s.length() - 1) / 2)) &&
                isPalindrom(s.substr((s.length() - 1 + 3) / 2));

  cout << (result ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ld  N;
  cin >>  N;
  cout <<stpr(10)<<(N/3)*(N/3)*(N/3)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()
 
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;}
int LCM(int a,int b){ return a*b / GCD(a,b) ;}
 
typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;

int main(){
      int n;
      cin >> n;
      vector<int> a(n);
      int sum = 0;
      rep(i,n){
            cin >> a[i];
            sum += a[i];
      }
      int ans = -1;
      int Min = INF;
      for(int i=0;i<n;i++){
            if(abs(a[i]*n - sum) < Min){
                  Min = abs(a[i]*n - sum);
                  ans = i;
            }            
      }
      cout << ans << endl;

      return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
string s;
using MIte = multimap<int, int>::iterator;

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

	vector<vector<int> > vvPosi(26, vector<int>(0));
	for (int i = 0; i != s.length(); i++) {
		int chara = (int)(s[i] - 'a');
		vvPosi[chara].push_back(i);
	}

	//	for (int i = 0; i != 26; i++) {
	//		sort(vvPosi[i].begin(), vvPosi[i].end());
	//	}

	bool fail = false;
	for (int i = 0; i != t.size(); i++) {
		// t[i]がsの何番目の文字かを求める
		if (vvPosi[(int)(t[i] - 'a')].empty()) {
			fail = true;
			break;
		}
	}

	if (!fail) {
		long long nDecrease = 0;
		long long previdx = -1;
		for (int i = 0; i != t.size(); i++) {
			const vector<int>& vtmpPosi = vvPosi[(int)(t[i] - 'a')];

			int tmpidx1 = previdx;
			//			bool judge = false;
			auto it = lower_bound(vtmpPosi.begin(), vtmpPosi.end(), (tmpidx1 + 1));
			//			for (int j = 0; j != vtmpPosi.size(); j++) {
			//				int tmpidx2 = vtmpPosi[j];
			//				if (tmpidx2 > tmpidx1) {
			//					previdx = tmpidx2;
			//					judge = true;
			//					break;
			//				}
			//			}
			if (it == vtmpPosi.end()) {
				nDecrease++;
				previdx = vtmpPosi[0];
			}
			else {
				previdx = (*it);
			}
			//			if (!judge) {
			//				nDecrease++;
			//				previdx = 0;
			//			}
		}

		long long ans = (long long)nDecrease * s.size() + previdx + 1;

		cout << ans << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
import java.util.Scanner;

class Main{

    static Scanner scan = new Scanner(System.in);


    //Male:1
    //Female:-1
    static int ask(int i){
        System.out.println(i);
        String s = scan.next();
        if(s.equals("Vacant"))return 0;
        if(s.equals("Male"))return 1;
        return -1;
    }

    public static void main(String[] args){

        int N = scan.nextInt();

        int left=0,right=N;
        int even = ask(0);
        if(even==0)return;

        while(true){
            int center = (left+right)/2;
            int sex=ask(center);
            if(sex==0)return;
            if(center%2==0){
                if(sex==even)left=center;
                else right=center;
            }else{
                if(sex!=even)left=center;
                else right=center;
            }
            
        }
    }
}

Measured memory_bytes: 24100
# include <iostream>

# include <bits/stdc++.h>

using namespace std;
int main(){
string s ;
cin>>s;
if (s =="A")
    cout<<"T";
else if (s=="T")
cout<<"A";
else if (s=="C")
    cout<<"G";
else if (s=="G")
    cout<<"C";
}


Measured memory_bytes: 256
using System;
namespace q1
{
    class q2
    {
        static void Main()
        {
            string[] kosuumae = Console.ReadLine().Split();
            int kosuua = int.Parse(kosuumae[0]);
            int kosuub = int.Parse(kosuumae[1]);
            int kotae = 0;
            for (int ruupu = 0; ruupu < kosuua; ruupu++)
            {
                string[] x = Console.ReadLine().Split();
                long x0 = long.Parse(x[0]);
                long x1 = long.Parse(x[1]);
                double a = Math.Sqrt(x0 * x0 + x1 * x1);
                if (a <= kosuub)
                {
                    kotae = kotae + 1;
                }
                else
                {
                }
            }
            Console.WriteLine(kotae);
        }
    }
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  if(n%2 == 1){
    cout << "No" << endl;
    return 0;
  }
  else{
    for(int i = 0;i < n/2;i++){
      if(s.at(i) != s.at(n/2+i)){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
 
using namespace std;
 
int maxx = -10000, minn = 0x7fffffff;
 
int main() {
	ios::sync_with_stdio(false);
	int n, m, X, Y, x, y;
	cin>>n>>m>>X>>Y;
	for (int i = 1; i <= n; i++) {
		cin>>x;
	  maxx = max(maxx, x);
	}
	for (int i = 1; i <= m; i++) {
		cin>>y;
	  minn = min(minn, y);
	}
	for (int i = maxx + 1; i <= minn; i++) {
	  if (i > X && i <= Y) {
		  printf("No War\n");
		  return 0;
		}
	}
	printf("War\n");
  return 0;
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:44 on 2019-12-08.
 */
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    ll h, w;
    cin >> h >> w;
//    vector<vector<ll>> a(h, vector<ll>(w)), b(h, vector<ll>(w));
    int a[h][w], b[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) cin >> b[i][j];

    ll max_diff = 2 * 80 * 160;
    vector<vector<vector<int>>> dp(h, vector<vector<int>>(w, vector<int>(max_diff)));
//    bool dp[h][w][max_diff];
    rep(i, h) rep(j, w) rep(l, max_diff) dp[i][j][l] = false;

    ll mid = max_diff / 2;
    dp[0][0][b[0][0] - a[0][0] + mid] = true;
    dp[0][0][-b[0][0] + a[0][0] + mid] = true;

    rep(i, h) {
        rep(j, w) {
            rep(l, max_diff) {
                if (!dp[i][j][l]) continue;
                if (i + 1 <= h - 1) {
                    dp[i + 1][j][l + b[i + 1][j] - a[i + 1][j]] = true;
                    dp[i + 1][j][l - b[i + 1][j] + a[i + 1][j]] = true;
                }
                if (j + 1 <= w - 1) {
                    dp[i][j + 1][l + b[i][j + 1] - a[i][j + 1]] = true;
                    dp[i][j + 1][l - b[i][j + 1] + a[i][j + 1]] = true;
                }
            }
        }
    }
    ll ans = 1e18;
    rep(i, max_diff) {
        if (dp[h - 1][w - 1][i]) ans = min(ans, abs(i - mid));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 648704
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}
 
 
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) r = (r * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return r;
}
 
void solve(){
	int n, k;
	cin >> n >> k;
	vector<int> d(k);
	rep(i, k) cin >> d[i];
	while(1) {
		string s = to_string(n);
		unordered_map<int, int> m;
		for(char c: s) m[c - '0']++;
		for(int u: d) {
			if (m[u]) {
				n++;
				break;
			}
		}
		if (to_string(n) == s) break;
	}
	cout << n;
}
 
int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
	//cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		DecimalFormat format = new DecimalFormat("#0.000000");
		while(sc.hasNext()){
			String[] str=sc.next().split(",");
			double x1=Double.parseDouble(str[0]),
					y1=Double.parseDouble(str[1]),
					x2=Double.parseDouble(str[2]),
					y2=Double.parseDouble(str[3]),
					xq=Double.parseDouble(str[4]),
					yq=Double.parseDouble(str[5]);
			double x,y,d,e;
			if(x1 == x2){
				y = yq; x = 2*x1 - xq;
			}
			else if(y1 == y2){
				x = xq;
				y = 2*y1 - yq;
			}else{
				d = (y2 - y1)/(x2 - x1);
				e = y1 - d*x1;
				x = (2*yq*d - 2*d*e + xq - d*d*xq)/(d*d + 1);
				y = (xq - x)/d + yq;
			}
			 System.out.println(format.format(x) + " " + format.format(y));
		}
	}
}

Measured memory_bytes: 26132
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
  	if(s.at(i)=='1') s.at(i)='9';
    else if(s.at(i)=='9') s.at(i)='1';
  }
  for(int i=0;i<3;i++){
  	cout<<s.at(i);
  }
  cout<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t N;
  int res = 11; 
  cin >> N;
  
  for (int i=1; i<= sqrt(N); i++) {
    int64_t j = N / i;
    if( i * j == N ) {
      int I = to_string(i).size();
      int J = to_string(j).size();
      int R = max(I,J);
      res = min(res,R );
    }
  }
  cout << res << endl;
}

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	ll ans = a[0];
	rep(i,n){
		ans = __gcd(ans, a[i]);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1024
import sys

S = list(input())
i = 0
cnt = 0

if len(S) == 1:
    print(0)
    sys.exit()

while True:
    if i == len(S) - 2:
        if S[i] != S[i+1]:
            cnt += 2
        break
    if S[i] != S[i+1]:
        cnt += 2
        S.pop(i)
        S.pop(i)
        if i > 0:
            i -= 1
    else:
        i += 1
print(cnt)

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
int main()
{
   /*int a,b,c;
   cin>>a>>b>>c;
   bool oh=0;
  if(a==b&&b==c&&a==c) oh=1;
  else if(a!=b&&b!=c&&c!=a) oh=0;

  if(oh==1)cout<<"No"<<endl;
  else if(oh!=1) cout<<"Yes"<<endl;

  // if() cout<<"No"<<endl;
   //else if(oh==0&&ohh==1&&ohhh==1) cout<<"No"<<endl;
   //else if(oh==1&&ohh==0&&ohhh==1) cout<<"No"<<endl;
   //else if(oh==1&&ohh==1&&ohhh==0) cout<<"No"<<endl;
  // else cout<<"Yes"<<endl;*/

    int a,b,c;
     cin>>a>>b>>c;
    bool oh = true;
    if(a==b&&b==c)oh=false;
    if(a!=b&&a!=c&&b!=c)oh=false;

    if(oh==true) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



   return 0;
}

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

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

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

int main()
{
    string s; cin >> s;
    if(s == "RRR") cout << 3 << endl;
    else if(s == "SRR" || s == "RRS") cout << 2 << endl;
    else if(s == "SSS") cout << 0 << endl;
    else cout << 1 << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << ' ' << y << ' ' << z << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 256
# 初期入力　２０２０－０７２７　21：50
import sys
#input = sys.stdin.readline  #文字列では使わない
M1,D1 = map(int, input().split())
M2,D2 = map(int, input().split())

import datetime
import calendar
def get_last_date(dt):
    return dt.replace(day=calendar.monthrange(dt.year, dt.month)[1])

dt = datetime.datetime(2019, M1, D1)

if dt ==get_last_date(dt):
    print(1)
else:
    print(0)

Measured memory_bytes: 10192
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int gcd(int a, int b) {
  if(b == 0) {
    return a;
  }
  int c = a % b;
  return gcd(b, c);
}

int main() {
  int x, y;
  cin >> x >> y;
  if(y < x) {
    swap(x, y);
  }
  int ans = gcd(x, y);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3080
#include <stdio.h>
#define N 101
#define WHITE 0
#define BLACK 1
#define GRAY 2

void DFSvisit(int);
void DFS(void);

int vertex[N];
int color[N];
int d[N];
int f[N];
int e[N];
int time;
int n;
int G[N][N];

int main(void){

  int i, j;


  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    scanf("%d %d", &vertex[i], &e[i]);
    for(j = 1;j <= e[i];j++)
      scanf("%d", &G[vertex[i]][j]);
  }

  DFS();
  
  for(i = 1;i <= n;i++)
    printf("%d %d %d\n",vertex[i], d[vertex[i]], f[vertex[i]]);
   
  return 0;
}


void DFS(){

  int u;

  for(u = 1;u <= n;u++)
    color[u] = WHITE;

  time = 0;

  for(u = 1;u <= n;u++){
    if(color[u] == WHITE)
      DFSvisit(u);
  }

}

void DFSvisit(int u){

  int v;

  color[u] = GRAY;
  time++;
  d[u] = time;

  for(v = 1;v <= e[u];v++){
    if(G[u][v] && (color[G[u][v]] == WHITE))
      DFSvisit(G[u][v]);
  }

  color[u] = BLACK;
  f[u] = ++time;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
int main() {
  int D;
  cin >> D;
  if (D == 25) {
    cout << "Christmas" << endl;
  }
  else if (D == 24) {
    cout << "Christmas Eve" << endl;
  }
  else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  }
  else if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = (int) s.size();
  int sm = 0;
  for (char &c : s) {
    c -= '0';
    sm += c;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] != '0') {
      cout << max(sm, s[i] - 1 + 9 * (n - 1 - i)) << '\n';
      return 0;
    }
  }
}


Measured memory_bytes: 3620
/*
对于涉及到大小比较的问题，有一个比较经典的思考方法是思考0/1的情况，然后通过一些手段把原问题转化成0/1的情况
对于此题，可以通过二分答案mid，把<= mid的当作0、把> mid的当作1，从而转化成0/1的问题
考虑0/1的问题怎么做。定义一个底端长度>= 2的相等连续段为“柱子”
容易发现柱子可以一直往上延伸到不存在，延伸到的部分的值都是柱子的值；同时一个柱子两侧的变化情况都是独立的。分情况讨论：
1、没有柱子。那么顶端的值就是底端中较多的数
2、顶端在某一个柱子中。那么顶端的值就是该柱子的值
3、顶端的某一边有一个柱子，另一边没有柱子。那么顶端的值就是该柱子的值
4、顶端两边都有柱子且值相同。那么顶端的值就是这个值
5、顶端两边都有柱子且值不同。那么顶端的值就是靠近中间的柱子的值 
*/

#include <cstdio>

using namespace std;

void Get_Val(int &Ret)
{
	Ret = 0;
	char ch;
	while (ch = getchar(), ch > '9' || ch < '0')
		;
	do
	{
		(Ret *= 10) += ch - '0';
	}
	while (ch = getchar(), ch >= '0' && ch <= '9');
}

const int Max_N(100050);

int N, A[Max_N << 1];
int Tot, L[Max_N], R[Max_N];

int work(const int &K)
{
	Tot = 0;
	for (int i = 1, j = 1;i <= 2 * N - 1;++i)
		if (i == 2 * N - 1 || (A[i + 1] > K) != (A[i] > K))
		{
			if (j < i)
			{
				++Tot, L[Tot] = j, R[Tot] = i;
				if (L[Tot] <= N && N <= R[Tot])
					return A[i] > K;
			}
			j = i + 1;
		}
	if (Tot == 0)
		return A[1] > K;
	int a(-1), b(-1);
	for (int i = 1;i <= Tot;++i)
		if (R[i] < N)
			a = R[i];
	for (int i = Tot;i >= 1;--i)
		if (L[i] > N)
			b = L[i];
	if (a == -1 || b == -1)
		return A[a + b + 1] > K;
	if ((A[a] > K) == (A[b] > K))
		return A[a] > K;
	else
		return N - a < b - N ? A[a] > K : A[b] > K;
}

int main()
{
	Get_Val(N);
	for (int i = 1;i <= 2 * N - 1;++i)
		Get_Val(A[i]);
	int l(1), r(2 * N), mid;
	while (l < r)
	{
		mid = l + ((r - l) >> 1);
		if (work(mid) == 0)
			r = mid;
		else
			l = mid + 1;
	}
	printf("%d", l);
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI b(n+1);
  int ans = 0;
  rep(i, n-1) {
    cin >> b[i+1];
  }
  b[0] = b[n] = INF;
  rep(i, n) ans += min(b[i], b[i+1]);
  out(ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	string str;
	cin >> str;
	bool flag=false;
	for(int i=0;i<str.size()-1;i++){
		if(str[i]=='A' && str[i+1]=='C'){
			flag=true;
		}
	}
	printf("%s\n",flag?"Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;

int main(){

ll N;

cin >> N;

vector<string> S(N);

for(ll i = 0;i < N;++i)    cin >> S[i];

sort(S.begin(), S.end());
S.erase(unique(S.begin(), S.end()), S.end());

ll ans = S.size();

cout << ans << endl;

return 0;

}   


Measured memory_bytes: 9524