akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut cnt = 0;
    let mut x = 0;

    loop {
        if cnt >= n {
            puts!("-1\n");
            return;
        } else if x == 1 {
            puts!("{}\n",cnt);
            return;
        }

        x = a[x] - 1;
        cnt += 1;
    }

}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 2260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 1;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, 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;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans %= mod;
        ans *= power(i + 1, mod - 2);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n,ans = 0;
    cin >> n;
    vector<ll> a(n),c(n,0),c2(n,0);
    rep0(i, n){
        cin >> a[i];
        --a[i];
        ++c[a[i]];
    }
    rep0(i, n){
        if(c[i] == 0 || c[i] == 1){
            c[i] = 0;
            continue;
        }
        c2[i] = (c[i] - 1) * (c[i] - 2) / 2;
        c[i] = c[i] * (c[i] - 1) / 2;
        ans += c[i];
    }
    rep0(i, n)pf(ans - c[a[i]] + c2[a[i]]);
    return 0;
}


Measured memory_bytes: 7296
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]

count = 0
flag =0
for i in range(N):
    if D[i][0] == D[i][1]:
        count += 1
    else :
        count = 0
    if count >2 :
        flag=1;

if flag == 1:
    print("Yes")
else :
    print("No")

Measured memory_bytes: 62352
#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;
  
  bool ans = false;
  int x;
  
  REP(i,9) {
    if (n%(i+1) == 0) {
      x = n / (i+1);
      REP(j,9) {
        if (x == 1*(j+1)) ans = true;
      }
    }
  }
  
  cout << (ans ? "Yes" : "No") << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N =sc.nextInt();

      for(int i=0;i<N;i++){
      int a =sc.nextInt();
      if(a%2==0 && a%3!=0 && a%5!=0){
      System.out.println("DENIED");
        return;
      }
      }
        System.out.println("APPROVED");
      
      
    }
}


Measured memory_bytes: 24020
#include <stdio.h>
void print_insertionSort(int a[], int n)
{
    int i, j, v;

    for (i = 1; i < n; i++)
    {
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v)
        {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        for (int k = 0; k < n - 1; k++)
        {
            printf("%d ", a[k]);
        }
        printf("%d\n", a[n - 1]);
    }
}
int main(void)
{
    int n, k;
    int a[1000];
    scanf("%d", &n);
    for (k = 0; k < n; k++)
    {
        scanf("%d", &a[k]);
    }

    for (k = 0; k < n - 1; k++)
    {
        printf("%d ", a[k]);
    }
    printf("%d\n", a[n - 1]);

    print_insertionSort(a, n);

    return 0;
}



Measured memory_bytes: 2688
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define PER(i,a,b) for(int i=(a);i>=(b);i--)
#define RVC(i,S) for(int i=0;i<(S).size();i++)
#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
     
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
/*============ Header Template ============*/

int main() {
    LL n;
    read(n);
    LL m=2*(n/11);n%=11;
    if(n) {
        if(n<=6) m+=1; else m+=2;
    }
    printf("%lld\n",m);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
#define int long long
int dp[3010][3010];
main(){
	int n,m,i,j;
	string s,t,a="";
	cin>>s>>t;
	s=' '+s;
	t=' '+t;
	n=s.size();
	m=t.size();
	for (i=1;i<=n;++i){
		for (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][j-1],dp[i-1][j]);
		}
	}
	while (n>0 && m>0){
		if (s[n-1]==t[m-1]){
			a=t[m-1]+a;
			n--;m--;
		}
		else if (dp[n-1][m]>dp[n][m-1])n--;
		else m--;
	}
	a.erase(0,1);
	cout <<a;
}

Measured memory_bytes: 70784
#include <stdio.h>

int main(void) {

	int A;
	int B;
    int N;

	scanf("%d", &N);
	scanf("%d", &A);      
    scanf("%d", &B);   
    
    int K = A * N;
    if(K == B){
      printf("%d",B);
    }
    else if(K < B){
      printf("%d",K);
    }
    else{
      printf("%d",B);
    }

      
  
	return 0;
}



Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int n;
	scanf("%d", &n);
	int a[n];
	lli ans = 0;
	rep(i, n) scanf("%d", &a[i]);
	
	rep(i, n-1){
		ans += a[i]/2;
		a[i] = a[i]%2;
		if(a[i] == 1 && a[i+1] != 0){
			a[i]--; a[i+1]--;
			ans++;
		}
	}

	cout << ans + a[n-1]/2 << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#define int long long
const int M = 200005;
int read()
{
	int x=0,flag=1;char c;
	while((c=getchar())<'0' || c>'9') if(c=='-') flag=-1;
	while(c>='0' && c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return x*flag;
}
int n,ans,a[M],b[M];
signed main()
{
    n=read();
    for(int i=1;i<=n;i++)
    {
        a[i]=read();
        if(i-a[i]>=1)
            ans+=b[i-a[i]];
        if(i+a[i]<=n)
            b[i+a[i]]++;
    }
    printf("%lld\n",ans);
}


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

#define SIZE 100005
#define PI acosl(-1) //3.14159265358979323846264338327950L 
#define rep(i, N) for (i = 0; i < N; i++) //制御変数iを用いてN回転
#define array(N, t) (t*)calloc(N, sizeof(t)) //t型N要素の1次元配列を動的確保後0クリア(freeを忘れずに)
#define zero(a); {int iter; rep(iter, sizeof(a)/sizeof((a)[0])) (a)[iter]=0;} //1次元配列aのゼロ初期化?

typedef long long ll; typedef long double ld;
typedef struct node { int data; struct node *next; } Node;

Node *list[SIZE];
int queue[SIZE]; int q_head = 0, q_tail = 0;

void print_log(); //とりあえず文字を出力してどこまで実行できているか確認(for debug)
void printa_int(int *a, int size); //int型の1次元配列aを出力(for debug)
void printl_int(int size); //リンクリストを出力(for debug)
Node* add_node(int i, int data); void free_list(Node* head);
int queue_empty(); int queue_full();
void enqueue(int data); int dequeue();

int main() {
    int i, N;
    scanf("%d", &N);
    ll *A = array(N, ll);
    rep(i, N) {
        scanf("%lld", A + i);
        if (!A[i]) {
            printf("0\n");
            return 0;
        }
    }
    ll ans = 1, temp = 1;
    rep(i, N) {
        if (ans > (ll)1e18 / A[i]) {
            printf("-1\n");
            return 0;
        }
        ans *= A[i];
        temp = ans;
    }
    printf("%lld\n", ans);
    return 0;
}

void print_log() {
    printf("=== print log ===\n");
}
void printa_int(int *a, int size) {
    int i;
    printf("[");
    for (i = 0; i < size; i++)
        printf("%d, ", a[i]);
    printf("]\n");
}
void printl_int(int size) {
    int i;
    Node *t;
    rep(i, size) {
        printf("[%d] ", i);
        for (t = list[i]; t; t = t->next) printf("%d, ", t->data);
        printf("\n");
    }
}
Node* add_node(int i, int data) {
    if (!list[i]) {
        list[i] = (Node*)malloc(sizeof(Node*));
        list[i]->data = data;
    } else {
        Node *t;
        t = list[i];
        list[i] = (Node*)malloc(sizeof(Node*));
        list[i]->data = data;
        list[i]->next = t;
    }
    return list[i];
}
void free_list(Node* head) {
    Node *prev = NULL, *t = head;
    while (t) {
        prev = t;
        t = t->next;
        free(prev);
    }
}
int queue_empty() {
    return q_head == q_tail;
}
int queue_full() {
    return (q_head - 1) % SIZE == q_tail % SIZE;
}
void enqueue(int data) {
    if (queue_full()) {
        printf("full!\n");
        return;
    }
    queue[q_tail++] = data;
    q_tail %= SIZE;
}
int dequeue() {
    if (queue_empty()) {
        printf("empty!\n");
        return -444444;
    }
    int data = queue[q_head++];
    q_head %= SIZE;
    return data;
}

Measured memory_bytes: 2468
a = int(input())
R0 = 3
R1 = 2
R2 = 1
R = int((a-1)/3)
if a == 1:
  print("1")
elif a == 2:
  print("3")
elif a == 3:
  print("4")
else:
  for i in range(R):
    R1 = R2+R0
    R2 = R0+R1
    R0 = R1+R2
  if a%3 == 0:
    R1 = R2+R0
    print(R1)
  elif a%3 == 1:
    print(R2)
  else:
    print(R0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define ll long long
//#define file
using namespace std;

int n,i,j,k,l,x;
int jh(int t,int x,int y) {return t==x?y:(t==y?x:t);}

int main()
{
	#ifdef file
	freopen("agc035c.in","r",stdin);
	#endif
	
	scanf("%d",&n);
	if (pow(2,floor(log2(n)))==n) {printf("No\n");return 0;}
	
	printf("Yes\n");
	if (!(n&1))
	{
		if (!(((n-1)+1)&2))
		{
			x=n^(n-1);
			fo(i,1,n-2) printf("%d %d\n",jh(i,1,x),jh(i+1,1,x));
			printf("%d %d\n",jh(n-1,1,x),jh(n+1,1+n,x+n));
			fo(i,1,n-2) printf("%d %d\n",jh(i+n,1+n,x+n),jh(i+1+n,1+n,x+n));
			printf("%d %d\n",n,n-1),printf("%d %d\n",x+n,n+n);
		}
		else
		{
			x=n^(n-2)^1;
			fo(i,1,n-4) printf("%d %d\n",jh(i,2,x),jh(i+1,2,x));
			fo(i,1,n-4) printf("%d %d\n",jh(i+n,2+n,x+n),jh(i+1+n,2+n,x+n));
			printf("%d %d\n",jh(n-3,2,x),jh(n+1,2+n,x+n));
			printf("%d %d\n",n-2,n-1),printf("%d %d\n",n-1,1),printf("%d %d\n",1,n-2+n),printf("%d %d\n",n-2+n,n-1+n);
			printf("%d %d\n",n,n-2+n),printf("%d %d\n",x,n+n);
		}
	}
	else
	if (!((n+1)&2))
	{fo(i,1,n+n-1) printf("%d %d\n",i,i+1);}
	else
	{
		fo(i,1,n-3) printf("%d %d\n",i,i+1);
		fo(i,1,n-3) printf("%d %d\n",i+n,i+1+n);
		printf("%d %d\n",n-2,n+1);
		printf("%d %d\n",n-1,n),printf("%d %d\n",n,1),printf("%d %d\n",1,n-1+n),printf("%d %d\n",n-1+n,n+n);
	}
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

Measured memory_bytes: 2816
n,k = [int(i) for i in input().split()]
count = 0
if k == 0:
    count = n**2
else:
    for K in range(k,n):
        waru = K+1
        p,r = divmod(n,waru)
        count += p * (waru - k) + max(0,r-k+1)

print(count)

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

using namespace std;

const int N = 1e5 + 9;

int n[2], cumu[2][N];
string s[2];

void readInput() {
    
    for(int i = 0; i < 2; i ++) {
        cin >> s[i];
        n[i] = s[i].size();
    }
}

void preProcess() {

    for(int i = 0; i < 2; i ++) {
        cumu[i][0] = s[i][0] - 'A' + 1;
        for(int j = 1; j < n[i]; j ++) {
            cumu[i][j] = cumu[i][j - 1] + (s[i][j] - 'A' + 1);
        }
    }
}   

int main(int argc, char const *argv[]) {
    
    readInput();
    preProcess();

    int q;
    scanf("%d", &q);

    while(q --) {

        int a, b, c, d;
        scanf("%d %d %d %d", &a, &b, &c, &d);
        a--; b--; c--; d--;

        if((cumu[0][b] - (a ? cumu[0][a - 1] : 0)) % 3 == (cumu[1][d] - (c ? cumu[1][c - 1] : 0)) % 3) {
            printf("YES\n");
        }
        else printf("NO\n");
    }

    return 0;
}

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

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

	bool ans = false;
	for (int i = 0; i < s.size(); i++) {
		if (s == t) {
			ans = true;
			break;
		}
		s = s.back() + s.substr(0, s.size() - 1);
	}

	if (ans) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
x = []
for line in sys.stdin:
    h,w = line.split()
    h,w = int(h), int(w)
    if h == 0 and w== 0: break
    x.append([h,w])

for i in range(len(x)):
    h, w = x[i]
    s1 = '#' * w
    if w<2:
        s2 = s1
    else:
        s2='#' + '.' * (w-2) + '#'
    for j in range(h):
        if j in [0, h-1]: print s1
        else: print s2
    print

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

int main() 
{
    vector<vector<int>>A(3,vector<int>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A.at(i).at(j);
        }
    }
    int N;
    cin >> N;
    vector<vector<bool>>flag(3,vector<bool>(3, false));
    for (int i = 0; i < N; i++) {
        int X = 0;
        cin >> X;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == X) {
                    flag[i][j] = true;
                }
            }
        }
    }
    
    string ans = "No";
    for (int i = 0; i < 3; i++) {
        if (flag.at(i).at(0) && flag.at(i).at(1) && flag.at(i).at(2)) {
            ans = "Yes";
        }
    }
    for (int i = 0; i < 3; i++) {
        if (flag.at(0).at(i) && flag.at(1).at(i) && flag.at(2).at(i)) {
            ans = "Yes";
        }
    }
    if (flag.at(0).at(0) && flag.at(1).at(1) && flag.at(2).at(2)) {
        ans = "Yes";
    }
    if (flag.at(0).at(2) && flag.at(1).at(1) && flag.at(2).at(0)) {
        ans = "Yes";
    }
    cout << ans << endl;
    
}

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

#define p pair<int,int>
#define f first
#define s second
#define ll long long
#define db double

const int maxn=1e6+10;
const int inf=1e9;

int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    string s;
    cin>>s;
    int n=s.size();
    cout<<s[0]<<s.size()-2<<s[n-1];
    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 repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  if (y > x)
    return gcd(y, x);
  else
    return gcd(y, x % y);
}

int main() {
  int k;
  cin >> k;
  ll ans = 0;
  repi(i, 1, k + 1) repi(j, 1, k + 1) repi(l, 1, k + 1) {
    ans += gcd(gcd(i, j), l);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n, m;
  long long a[MAX], ans = 0;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%lld", &a[i]);
  }
  sort(a, a+n);
  for(int i = 0; i < n/2-1; i++) ans -= a[i]*2;
  ans += (n&1 ? max(-a[n/2]-a[n/2-1], -a[n/2-1]*2+a[n/2]-a[n/2+1]) : a[n/2]- a[n/2-1]);
  for(int i = n/2+1; i < n; i++) ans += a[i]*2;
  
  printf("%lld\n", ans);
}


Measured memory_bytes: 1024
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 各queryについてO(n)で答える
# 問題を言い換えると　　

# 地点Xに到着するのは時間 Di + Xの時
# S <= Di + X < Tとなる[S, T, N]がなければ通過できる
# SについてXの早い順にソートする

# 各Dについて、どのSまで通過できるかを各O(1)で答える？

N,Q = getNM()
# taskに
# 0:通行止め時間帯のスタート
# 1:通行止め時間帯のゴール
# 2:人
# を入れ、全部まとめて処理する
task = []

STX = [getList() for _ in range(N)]
for s, t, x in STX:
    task.append((t - x, 0, x)) # xで止まらなくなる
    task.append((s - x, 1, x)) # xで止まる

for i in range(Q):
    d = getN()
    task.append((d, 2, i)) # 止まる位置を答える
answer = [-1] * Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapで最小値を先頭に保つ
heapq.heapify(se_hp)

# 小さい時刻から順に見ていく
# 人ciについてどの範囲cjの範囲内に入っているか
for a, b, c in task:
    # ゴール位置についての情報なら
    if b == 0:
        # そのゴールに対応するスタート位置を取り除く
        se.remove(c)
    # スタートについての情報なら
    elif b == 1:
        # スタート位置を追加する
        se.add(c)
        # スタート位置の最小値候補に入れる
        heapq.heappush(se_hp, c)
    # 人についての情報なら
    else:
        # se_hpの最小値がseにない（用済みのものが残っている）間
        # またはse_hpを抜き切るまで
        while se_hp and se_hp[0] not in se:
            heapq.heappop(se_hp)
        if se_hp:
            answer[c] = se_hp[0]
        else:
            answer[c] = -1
    # (-3, 1, 10) 10のものについてスタートを追加
    # se:{10} se_hp:[10]
    # (-1, 1, 2) 2のものについてスタートを追加
    # se:{10, 2} se_hp:[2, 10]
    # (0, 2, 0) 人0について調べる
    # se:{10, 2} se_hp[2, 10]
    # (1, 0, 2) 2のものについてゴールが来たのでスタート位置を取り除く
    # se:{10} se_hp:[2, 10] se_hpに余計なものが残る
    # (1, 1, 2) 2のものについてスタート位置をまた追加
    # se:{10, 2} se_hp:[2, 10, 2]

for i in answer:
    print(i)

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

int main(){
	int a, b, k;
	cin >> a >> b >> k;
	for(int i = a; i <= b; i++){
		if(i <= a + k - 1 || i >= b - k + 1) cout << i << "\n";
	}
	return 0;
}

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

using namespace std;

int main(){
    string s,t;
    cin>>s>>t;
    map<char,char> hoge;
    map<char,char> fuga;
    
    string ans="Yes";
    
    for(int i=0;i<s.size();i++){
        if(!hoge.count(s.at(i))){
            hoge[s.at(i)]=t.at(i);
        }else{
            if(hoge.at(s.at(i))!=t.at(i)){
                ans="No";
                break;
            }
        }
        
        if(!fuga.count(t.at(i))){
            fuga[t.at(i)]=s.at(i);
        }else{
            if(fuga.at(t.at(i))!=s.at(i)){
                ans="No";
                break;
            }
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

string s;
int x;
bool done;
int p;

bool exec(){
  if(isdigit(s[p])){
    int n = 0;
    while(isdigit(s[p])){
      n = n*10 + s[p] - '0';
      p++;
    }
    if(isalpha(s[p])){
      if(x > n){
        x -= n;
        p++;
      }
      else {
        cout << s[p] << endl;
        return true;
      }
    }
    else {
      p++; // (
      int f = p;
      rep(i,n){
        p = f;
        if(exec()) return true;
      }
      p++; // )
    }
  }
  while(isalpha(s[p])){
    x--;
    if(x==0){
      cout << s[p] << endl;
      return true;
    }
    p++;
  }

  if(s[p]==')' || p==s.size()) return false;
  else return exec();
}

int main(){
  while(cin>>s>>x, s!="0"){
    done = false;
    p = 0;
    x++;
    if( ! exec() ){
      cout << 0 << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3224
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * Earth Invasion Diary of Miyabi-sensei
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int N = parseInt(br.readLine());

		long k = 1, _k = 1;
		while ((_k *= 3) < N) {
			k++;
		}
		System.out.println(k);
	}
}

Measured memory_bytes: 24420
#include <stdio.h>
#include <iostream>
using namespace std;

int A,B;
int main (){
	cin>> A >> B;
	if (A==1){
		if (B==2){
			cout <<"3";
		}else if (B==3){
			cout <<"2";
		}
	}else if (A==2){
		if (B==1){
			cout <<"3";
		}else if (B=3){
			cout <<"1";
		}
	}else if (A==3){
		if (B==1){
			cout <<"2";
		}else if (B==2){
			cout <<"1";
		}
	}
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n;
int a[5][105],dp[5][105];

signed main()
{
	cin>>n;
	for (int i=1;i<=2;i++)
	{
		for (int j=1;j<=n;j++)  cin>>a[i][j];
	}
	for (int i=1;i<=2;i++)
	{
		for (int j=1;j<=n;j++)  dp[i][j]=max(dp[i-1][j],dp[i][j-1])+a[i][j];
	}
	cout<<dp[2][n]<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 100001
typedef struct Process{
  int time;
  char name[10];
} proc;
int main(){
  int i,n,takenTime,head,tail,q;
  proc pc[N];
  scanf("%d %d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s %d",pc[i].name,&pc[i].time);
  }
  head = 0;
  tail = n;
  takenTime = 0;
  while( head != tail ){
    if( pc[head].time - q > 0 ){
      pc[tail].time = pc[head].time - q;
      strcpy(pc[tail].name,pc[head].name);
      takenTime += q;
      if( tail+1 > n ){
	tail = 0;
      }
      else tail++;
    }
    else{
      takenTime += pc[head].time;
      printf("%s %d\n",pc[head].name,takenTime);
    }
    if( head+1 > n ){
      head = 0;
    }
    else head++;
  }
  return 0;
}

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

using namespace std;

int main() {

        int N;

        cin >> N;

        int hundred = N / 100;
        int ten = (N - hundred * 100) / 10;
        int one = (N - hundred*100 - ten*10);

        if(hundred == 7 || ten == 7 || one == 7) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
	int p1, p2, p3, j1, j2;
	int pst, jic;
	
	scanf("%d %d %d %d %d", &p1, &p2, &p3, &j1, &j2);
	pst = p1;
	if (pst > p2) {
		pst = p2;
	}
	if (pst > p3) {
		pst = p3;
	}
	jic = (j1 > j2) ? j2 : j1;
	
	printf("%d\n", pst + jic - 50);
	
	return (0);
}

Measured memory_bytes: 592
import sys
sys.setrecursionlimit(10**7)
def dfs(v,p):
    ans[v]=c.pop()
    for nv in G[v]:
        if nv==p:
            continue
        dfs(nv,v)

N=int(input())
G=[[] for i in range(N)]

for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
c=sorted(map(int,input().split()))
print(sum(c[:-1]))
ans=[-1]*N
dfs(0,-1)
print(*ans)

Measured memory_bytes: 82412
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    int dp[100100];
    int t[] = { 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049 };

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        for ( int i = 0; i <= n; i++ ) {
            dp[i] = i;
        }
        for ( int i = 0; i < 11; i++ ) {
            for ( int j = 0; j+t[i] <= n; j++ ) {
                chmin(dp[j+t[i]], dp[j]+1);
            }
        }

        echo dp[n] fin;


        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 640
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int a,b,c; cin >> a >> b >> c;
    cout << (a+b)*c/2 << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N=int(input())

if len(str(N))==1:
    ans=N
else:
    
    if 1==len(set(list(str(N))[1:])) and int(str(N)[1])==9:
        ans=9*(len(str(N))-1) + int(str(N)[0])
    else:
        ans=9*(len(str(N))-1) + int(str(N)[0])-1

print(ans)


Measured memory_bytes: 3060
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/
int k, x, menor, ans, n;
bool v[10], mayor;

bool can(){
    int aux = ans;
    while(aux){
        if(v[aux%10] == 0) return false;
        aux/=10;
    }
    return true;
}

int main(){
    ios::sync_with_stdio(0);
    cin >> n >> k;
    clean(v,1);
    forn(i,k){
        cin >> x;
        v[x] = 0;
    }

    ans = n;
    while(!can()) ans++;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
a, b = gets.chomp.split.map(&:to_i)
result = 0

if a > b
	result = a
	if a-1 > b
		result += a-1
	else
		result += b
	end
else
	result = b
	if a > b-1
		result += a
	else
		result += b-1
	end
end

puts result


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int N, H;
    cin >> N >> H;

    vector<int> a(N);
    vector<int> b(N);
    for(int i=0; i<N; i++) cin >> a[i] >> b[i];

    int aMax = 0;
    for(int i=0; i<N; i++)
        if(aMax<a[i]) aMax = a[i];
    sort(b.rbegin(), b.rend());

    int ans=0;
    for(int i=0; b[i]>aMax; i++){
        H -= b[i];
        ans++;
        if(H<=0) break;
    }

    if(H>0){
        ans += H/aMax;
        if(H%aMax) ans++;
    }

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


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


using ll = long long;


ll f(ll n)
{
    if (n == 1) return 1;
    return 1 + 2 * f(n / 2);
}


int main()
{
    ll h;
    cin >> h;
    cout << f(h) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(void) {
	// input
	long long n;
	std::cin >> n;

	long long power = 1;
	for(long long i = 1; i <= n; ++i) {
		power *= i;
		power %= 1000000007;
	}

	std::cout << power << std::endl;

	return 0;
}


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

#define ln '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

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;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VI a(n);
    REP(i, n) cin >> a[i];

    int d = 0;
    int sign = 1;
    REP(i, n) {
        d += a[i] * sign;
        sign *= -1;
    }

    cout << d << " ";
    FOR(i, 1, n - 1) {
        d = 2 * a[i - 1] - d;
        cout << d;
        if (i == n - 1) cout << ln;
        else cout << " ";
    }
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n;
long long k,pref[200100],a;
int di;
vector<long long> dis;
template<typename T,int sz>
struct binary_indexed_tree{
	#define lowbit(x)  ((x)&(-x))
	T dat[sz];
	void update(int x,T delta){
		for(;x<sz;x+=lowbit(x)){
			dat[x]+=delta;
		}
	}
	T get(int x){
		T res=0;
		for(;x;x-=lowbit(x)){
			res+=dat[x];
		}
		return res;
	}
};
binary_indexed_tree<int,200100> Bi;
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	pref[0]=0LL;
	for(int i=1;i<=n;i++){
		cin>>a;
		a-=k;
		pref[i]=pref[i-1]+a;
		dis.push_back(pref[i]);
	}
	dis.push_back(0);
	sort(dis.begin(),dis.end());
	dis.erase(unique(dis.begin(),dis.end()),dis.end());
	long long res=0LL;
	di=lower_bound(dis.begin(),dis.end(),0)-dis.begin()+1;
	Bi.update(di,1);
	for(int i=1;i<=n;i++){
		di=lower_bound(dis.begin(),dis.end(),pref[i])-dis.begin()+1;
		res+=(long long)(Bi.get(di));
		Bi.update(di,1);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 4336
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N; cin>>N;
  int n = N * 3;
  vector<int> A(n);
  for(int i=0; i<n; i++) {
    cin>>A[i];
  }
  sort(A.begin(), A.end());
  ll sum = 0;
  for(int i=N; i<n; i += 2) {
    sum += A[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 1408
s = input()
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n+3)//2-1:n]
flag = True
for i in range(len(s)//2):
    if s[i] != s[len(s)-i-1]:
        flag = False
for i in range(len(s1)//2):
    if s1[i] != s1[len(s1)-i-1]:
        flag = False
for i in range(len(s2)//2):
    if s2[i] != s2[len(s2)-i-1]:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
n=int(input())
c=input()
a=[]
for i in range(n):
    if(c[i]=='R'):
        a.append(0)
    else:
        a.append(1)

zero=0
one=0
for i in range(n):
    if(a[i]==0):
        zero+=1

ans=[zero]
for i in range(n):
    if(a[i]==0):
        zero-=1
    else:
        one+=1
    #print(zero,one)
    ans.append(max(zero,one))

print(min(ans))

Measured memory_bytes: 18788
#include "bits/stdc++.h"
using namespace std;

int logV;
vector<vector<int>> graph;
vector<vector<int>> parent;
vector<int> depth;

void dfs(int v, int p, int d) {
    parent[0][v] = p;
    depth[v] = d;
    for (int u : graph[v]) {
        if (u != p) dfs(u, v, d + 1);
    }
}

void build(int root) {
    logV = 1; int n_ = 1; while (n_ < graph.size()) n_ *= 2, logV++;
    parent.resize(logV, vector<int>(graph.size()));
    depth.resize(graph.size());
    dfs(root, -1, 0);
    for (int k = 0; k < logV - 1; ++k) {
        for (int v = 0; v < graph.size(); ++v) {
            if (parent[k][v] == -1) parent[k + 1][v] = -1;
            else parent[k + 1][v] = parent[k][parent[k][v]];
        }
    }
}

int lca(int u, int v) {
    if (depth[u] > depth[v]) swap(u, v);
    for (int k = 0; k < logV; ++k) {
        if ((depth[v] - depth[u]) >> k & 1) v = parent[k][v];
    }
    if (v == u) return v;
    for (int k = logV - 1; k >= 0; --k) {
        if (parent[k][u] != parent[k][v]) {
            u = parent[k][u];
            v = parent[k][v];
        }
    }
    return parent[0][u];
}

int main() {
    int n;
    cin >> n;
    graph.resize(n);
    for (int i = 0; i < n ; ++i) {
        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int c;
            cin >> c;
            graph[i].push_back(c);
        }
    }

    build(0);

    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int u, v;
        cin >> u >> v;
        cout << lca(u, v) << endl;
    }
}


Measured memory_bytes: 20504
#include <iostream>
using namespace std;
int main()
{
    string a;
    cin>>a;
    int l=10000000,r=-10000000;
    for(int i=0; i<a.size(); i++)
    {
        if(a[i]=='C') 
        {
            l=i;
            break;
        }
    }
    for(int i=0; i<a.size(); i++)
    {
        if(a[i]=='F') 
        {
            r=i;
        }
    }
    if(l<r)
    {
    	cout<<"Yes";
    }
    else
    {
    	cout<<"No";
    }
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int ans = 0;
        for (int i = 3; i <= N; i += 2)
        {
            int temp = 0;
            int j;
            for (j = 1; j * j < i; j++)
            {
                if ( i % j == 0)
                {
                    temp += 2;
                }
            }
            if (j * j == i)
            {
                temp++;
            }
            if (temp == 8)
            {
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::f64::consts::PI;

fn main() {
    input! {
        a: f64,
        b: f64,
        x: f64,
    }

    let h = x  / (a * a);
    let area = h * a;
    let deg;
    let len;

    if h < b / 2.0 {
        // h is less than b/2
        len = area / b * 2.0;
        deg = (b / len).atan() * 180.0 / PI;
    } else {
        // h is bigger than b/2
        len = (a*b - area) / a * 2.0;
        deg = (len / a).atan() * 180.0 / PI;
    }

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


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

int main() {
  int N;
  cin >> N;
  vector<int> ans;
  rep(i,N){
    int d;
    cin >> d;
    bool isFound = false;
    rep(j,ans.size()){
      if(ans.at(j) == d){
        isFound = true;
        break;
      }
    }
    if(!isFound) ans.push_back(d);
  }
  cout << ans.size() << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <queue>
#include <deque>
#include <iostream>
#include <cstdio>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1 ; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define FILL(a,b) memset(a , b , sizeof(a))
#define SZ(a) (int)a.size()
#define PB push_back
#define MP make_pair

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAX = 100007;
const int INF = 1000000000;

int main()
{
	//freopen("in.txt" , "r" , stdin);

	int x , y , z;
	cin >> x >> y >> z;
	//x = 1;
	//y = 1;
	//z = 99998;

	Int res = 0;

	vector<PII> A;

	int n = x + y + z;

	FOR(i,0,n)
	{
		int a , b , c;
		scanf("%d%d%d" , &a , &b, &c);
		//a = rand() % INF;
		//b = rand() % INF;
		//c = rand() % INF;

		res += a;
		b -= a;
		c -= a;
		A.push_back(MP(b , c));
	}

	sort(ALL(A));
	reverse(ALL(A));


	multiset<int> Y, Z;
	Int sy = 0;
	Int sz = 0;
	FOR(i,0,y)
	{
		res += A[i].second;
		Y.insert(A[i].first - A[i].second);
		sy += A[i].first - A[i].second;
	}
	FOR(i,y,n)
	{
		Z.insert(A[i].second);
		sz += A[i].second;
	}
	while (SZ(Z) > z)
	{
		int val = *Z.begin();
		sz -= val;
		Z.erase(Z.find(val));
	}


	Int bestRes = res + sy + sz;



	FOR(i,y, y + z)
	{
		res += A[i].second;
		Y.insert(A[i].first - A[i].second);
		sy += A[i].first - A[i].second;
		int val = *Y.begin();
		sy -= val;
		Y.erase(Y.find(val));

		if (Z.find(A[i].second) != Z.end())
		{
			Z.erase(Z.find(A[i].second));
			sz -= A[i].second;
		}
		else
		{
			int val = *Z.begin();
			sz -= val;
			Z.erase(Z.find(val));
		}
		bestRes = max(bestRes , res + sy + sz);
		//cout << res << ' ' << sy << ' ' << sz << endl;
	}

	cout << bestRes << endl;




}


Measured memory_bytes: 5748
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
ll m,d[100005],u[100005];
int n;
vector<int> v[100005];
void dfs1(int x,int y){
    d[x]=1;
    for(int i=0;i<v[x].size();++i){
        if(v[x][i]==y) continue;
        dfs1(v[x][i],x);
        d[x]=d[x]*(1ll+d[v[x][i]])%m;
    }
}
void dfs2(int x,int y){
    ll o=1ll+u[x];
    for(int i=0;i<v[x].size();++i){
        if(v[x][i]==y) continue;
        u[v[x][i]]=o;
        o=o*(1ll+d[v[x][i]])%m;
    }
    o=1;
    for(int i=v[x].size()-1;i>=0;--i){
        if(v[x][i]==y) continue;
        u[v[x][i]]=u[v[x][i]]*o%m;
        o=o*(1ll+d[v[x][i]])%m;
    }
    for(int i=0;i<v[x].size();++i){
        if(v[x][i]==y) continue;
        dfs2(v[x][i],x);
    }
}
int main(){
    scanf("%d%lld",&n,&m);
    for(int i=1;i<n;++i){
        int x,y;
        scanf("%d%d",&x,&y);
        v[x].pb(y),v[y].pb(x);
    }
    dfs1(1,0);
    dfs2(1,0);
    for(int i=1;i<=n;++i)printf("%lld\n",d[i]*(u[i]+1ll)%m);
	//system("pause");
	return 0;
}


Measured memory_bytes: 12672
n, m = map(int, input().split())

result = {}
fin = {}
success = 0
wa_sum = 0
for i in range(m):
    p, s = map(str, input().split())
    if not (p in result):
        result[p] = 0
        fin[p] = False
    if s == 'AC' and not fin[p]:
        fin[p] = True
        success += 1
        wa_sum += result[p]
    elif not fin[p]:
        result[p] += 1

print(success, wa_sum)




Measured memory_bytes: 23344