akhauriyash/Code-Regression huggingface dataset:
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
import math
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    R = I()
    print(2.0*R*math.pi)
if __name__ == '__main__':
    main()

Measured memory_bytes: 9492
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[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 ) * } } ; }
#[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 , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
   input!{a:i64,b:i64};
   println!("{}", if a%3==0 || b%3==0 || (a+b)%3==0 {"Possible"} else {"Impossible"});
}


Measured memory_bytes: 4352
import sys
import math
N, H = map(int, input().split())
a = []
b = []
for _ in range(N):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
a.sort(reverse=True)
b.sort(reverse=True)
ans = 0
for i in range(N):
    if b[i] < a[0]:
        break
    else:
        ans += 1
        H -= b[i]
        if H <= 0:
            print(ans)
            sys.exit()
ans += math.ceil(H / a[0])
print(ans)

Measured memory_bytes: 11264
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n;
		int r;
		int cards[];

		while (true){
			n = sc.nextInt();
			r = sc.nextInt();
			if (n == 0 && r == 0){
				break;
			}

			cards = new int[n];
			for (int i = 0; i < n; i++){
				cards[i] = n - i;
			}

			for (int i = 0; i < r; i++){
				cut(cards, sc.nextInt(), sc.nextInt());
			}

			System.out.println("" + cards[0]);
		}
	}

	public static void cut(int cards[], int p, int c){
		int save[] = new int[p - 1 + c];

		for (int i = 0; i < save.length; i++){
			save[i] = cards[i];
		}

		for (int i = 0; i < p - 1; i++){
			cards[c + i] = save[i];
		}

		for (int i = 0; i < c; i++){
			cards[i] = save[p - 1 + i];
		}
	}
}

Measured memory_bytes: 28284
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin >> n;
  int x;
  int arr[n];
  for(int i = 0 ; i < n ; i++) {
    cin >> x;
    arr[x - 1] = i;
  }
  if(n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int mx = 0 , cur = 1;
  for(int i = 1 ; i < n ; i++) {
    if(arr[i - 1] < arr[i]) cur++;
    else cur = 1;
    mx = max(mx , cur);
  }
  cout << n - mx << endl;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
height=list(map(int,input().split()))
hoge=[1 for i in range(n)]
#print(hoge)
for i in  range(m):
  a,b=map(int,input().split())
  #print(a,b,height[a-1],height[b-1])
  if(height[a-1]>height[b-1]):
    hoge[b-1]=0
  elif(height[a-1]<height[b-1]):
    hoge[a-1]=0
  else:
    hoge[a-1],hoge[b-1]=0,0
    
print(sum(hoge))

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

int N;
string S;

int main(void){
	
	scanf("%d", &N);
	cin >> S;
	
	int sum = 0, ins = 0;
	for(int i = 0; i < S.size(); ++i){
	    if(S[i] == '(') ++sum;
	    else{
	        --sum;
	        if(sum < 0) ins = max(ins, -sum);
	    }
	}
	for(int i = 0; i < ins; ++i) S = '(' + S; 
	
	sum = 0;
	for(int i = 0; i < S.size(); ++i){
	    if(S[i] == '(') ++sum;
	    else --sum;
	}
	for(int i = 0; i < sum; ++i) S = S + ')';
	cout << S << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };
typedef tuple<ll, ll, ll>T;
 
 
 
int main() {
	int h, w;
	cin >> h >> w;
 
	vector<string>a(h);
	for(int i = 0;i < h;i++)cin >> a[i];
	
	vector<vector<int>>v(h,vector<int>(w,-1));
	queue<pair<int,int>>q;
	for(int i = 0;i < h;i++){
      for(int j = 0;j < w;j++){
      if (a[i][j] == '#') {
		q.push({ i,j });
		v[i][j] = 0;
      }
      }
	}
 
 
	while (q.size()) {
		auto p = q.front();
		q.pop();
 
		int i = p.first;
		int j = p.second;
 
		int di[4] = { -1,0,1,0 };
		int dj[4] = { 0,1,0,-1 };
		rep(k, 0, 4) {
			int _i = i + di[k];
			int _j = j + dj[k];
			if (0 > _i || _i >= h || 0 > _j || _j >=w)continue;
				if (v[_i][_j] == -1) {
					q.push({ _i,_j });
					v[_i][_j] = v[i][j] + 1;
				}
		}
	}
 
	int ans = -1;
	for(int i = 0;i < h; i++)for(int j = 0;j < w;j++){
		ans = max(ans, v[i][j]);
	}
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 13456
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M, Dist[int(2e5 + 5)];
vector <int> Graph[int(2e5 + 5)];

int main(){
  scanf("%d%d", &N, &M);
  fill(Dist + 2, Dist + N + 1, -1);
  for (int i = 0; i < M; i++){
    int A, B; scanf("%d%d", &A, &B);
    Graph[A].push_back(B);
    Graph[B].push_back(A);
  }
  queue <int> que; que.push(1);

  while (!que.empty()){
    int Q = que.front(); que.pop();
    for (int i = 0; i < Graph[Q].size(); i++){
      int next = Graph[Q][i];
      if (Dist[next] != -1) continue;
      Dist[next] = Dist[Q] + 1;
      que.push(next);
    }
  }

  if (Dist[N] == 2) printf("POSSIBLE\n");
  else printf("IMPOSSIBLE\n");

  return 0;
}


Measured memory_bytes: 13168
#include<bits/stdc++.h>
using namespace std;
int main(){
  pair<int, int> p1,p2,p3,p4,v;
  cin>>p1.first>>p1.second>>p2.first>>p2.second;

  p3.first = -1 * (p2.second-p1.second) + p2.first;
  p3.second = (p2.first-p1.first) + p2.second;
  p4.first = -1 * (p2.first-p1.first) + p3.first;
  p4.second = -1 * (p2.second-p1.second) + p3.second;

  cout << p3.first << ' ' << p3.second << ' ' <<  p4.first << ' ' <<  p4.second<<endl;
  return 0;
}

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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

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

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n;
	string s;
	cin >> n  >> s;
	if (n%2 == 1) {
		cout << "No" << endl;
		return 0;
	}

	bool a = true;

	REP(i,n/2) {
		if(s[i] != s[i+n/2]) {
			a = false;
			break;
		}
	}
	if(a) {
		cout << "Yes" <<endl;
	} else {
		cout << "No" << endl;
	}
}



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


using namespace std;


int N,M;
const int SIZE = 5e5 + 7;
int c[SIZE];
int A[SIZE];
int Next[SIZE];
int res[SIZE];
int show[1000005];
bool fir[SIZE];


struct Q
{
    int l,r;
    int pos;
}q[SIZE];


int lowbit(int k)
{
    return k&(-k);
}


void modify(int n,int v)
{
    while(n <= N)
    {
        c[n] += v;
        n += lowbit(n);
    }
}


int sum(int n)
{
    int ans = 0;
    while(n > 0)
    {
        ans += c[n];
        n -= lowbit(n);
    }
    return ans;
}


int cmp(Q a, Q b)
{
    return a.l < b.l;
}


int main()
{
    scanf("%d%d",&N, &M);
    for(int i=1;i<=N;i++) scanf("%d",&A[i]);


    for(int i=N;i>=1;i--)
    {
        if(!show[A[i]])
        {
            show[A[i]] = i;
            fir[i] = true;
        }
        else
        {
            Next[i] = show[A[i]];
            fir[Next[i]] = false;
            fir[i] = true;
            show[A[i]] = i;
        }
    }


    for(int i=1;i<=M;i++)
    {
        scanf("%d%d",&q[i].l,&q[i].r);
        q[i].pos = i;
    }
    sort(q+1,q+1+M,cmp);


    for(int i=1;i<=N;i++)
        if(fir[i])
        {
            modify(i,1);
        }
    int qtemp = q[1].l;
    int ptr = 1;
    for(int i=1;i<=M;i++)
    {
        for(;ptr<q[i].l;ptr++)
        {
            if(fir[ptr])
            {
                modify(ptr,-1);
                fir[ptr] = false;
                if(Next[ptr])
                {
                    fir[Next[ptr]] = true;
                    modify(Next[ptr],1);
                }
            }
        }
        ptr = q[i].l;
        qtemp = q[i].l;
        res[q[i].pos] = sum(q[i].r) - sum(q[i].l-1);
    }
    for(int i=1;i<=M;i++) printf("%d\n",res[i]);
    return 0;
}


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

int N;

int main() {
    cin >> N;
    
    char A[N][N];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> A[i][j];
        }
    }
    
    int ans = 0;
    for (int k = 0; k < N; k++) { //縦にkだけ動かしたものが条件みたせば +N;
        bool flag = true;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (A[(i + k) % N][j % N] != A[(j + k) % N][i % N]) {
                    flag = false;
                    break;
                }
            }
            if (!flag) {
                break;
            }
        }
        if (flag) {
            ans += N;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = input()

if n == "A":
    print("T")
elif n == "G":
    print("C")
elif n == "T":
    print("A")
else:
    print("G")



Measured memory_bytes: 7120
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    _n: usize,
    s: chars,
  }
  let mut ans = 0;
  for p in 0 .. 1000 {
    let d = vec![p / 100, p / 10 % 10, p % 10];
    let mut i = 0;
    for &c in &s {
      let c = c as i32 - '0' as i32;
      if c == d[i] {
        i += 1;
      }
      if i == 3 {
        break;
      }
    }
    if i == 3 {
      ans += 1;
    }
  }

  puts!("{}\n", ans);
}


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

int main() {
	int n;
	cin >> n;
	int ans = 1e9;
	int count,a,j;
	for (int i = 0; i <= n; i++) {//i=6**n円で引き出す金額
		count = 0;
		a = i;
		j = n - a;
		while (a > 0) {
			count += a % 6;
			a /= 6;
		}
		while (j > 0) {
			count += j % 9;
			j /= 9;
		}
		ans = min(ans, count);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
 
/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 
 
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
 
/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;
 
/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
/* func */
int gcd(int a,int b){return b?gcd(b,a%b):a;}
 
/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;
 
/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
 
//#define int ll
//#define int long long
 
signed main()
{
 int a, b, k; cin >> a >> b >> k;
  int cnt = 0;
  vi v1(0,0);
  int whi = max(a,b);
  for(int i =1; i <= whi; ++i){
    if(a%i == 0&&b%i == 0){
     v1.PB(i);
      ++cnt;
    }
  }
/*for(int i = 1; i <= whi; ++i){
  cout << a%i;
  cout << b%i << endl;
}*/
  
//  REP(i, cnt){cout << v1[i] << endl;}
 
  reverse(v1.begin(),v1.end());
  cout << v1[k-1];
 
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(3)
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

map<string,int> m;
int main(int argc,char** argv){
	int n;
	cin>>n;
	rep(i,n){
		string s;
		cin>>s;
		m[s]++;
	}
	int mx=-INF;
	vector<string> v;
	foreach(it,m){
		if(it->sc>mx){
			mx=it->sc;
		}
	}
	foreach(it,m){
		if(it->sc==mx){
			v.pb(it->fi);
		}
	}
	sort(all(v));
	rep(i,sz(v)){
		cout<<v[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 27348
#include<cstdio>
using namespace std;
int gcd(int x,int y){
    int tmp;
    if(x<y){
        tmp=y;
        y=x;
        x=tmp;
    }
    while(y>0){
        tmp=x%y;
        x=y;
        y=tmp;
    }
    return x;
}
int main(){
    int x,y;
    scanf("%d %d",&x,&y);
    printf("%d\n",gcd(x,y));
    return 0;
}


Measured memory_bytes: 2740
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = s.Replace("?", "D");

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 28960
class SegmentTree:
    def __init__(self, n, init_value, ide_ele):
        self.num = 2 ** (n - 1).bit_length()
        self.ide_ele = ide_ele
        self.seg = [ide_ele] * 2 * self.num
        
        for i in range(n):
            self.seg[i + self.num - 1] = init_value[i]
        for i in range(self.num - 2, -1, -1):
            self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2])
    
    def update(self, _k, x):
        k = _k + self.num - 1
        self.seg[k] = x
        while k:
            k = (k - 1) // 2
            self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2])
    
    def query(self, _p, _q):
        p = _p
        q = _q
        if q <= p:
            return self.ide_ele
        
        p += self.num - 1
        q += self.num - 2
        res = self.ide_ele
        while 1 < q - p:
            if p & 1 == 0:
                res = self.segfunc(res, self.seg[p])
            if q & 1 == 1:
                res = self.segfunc(res, self.seg[q])
                q -= 1
            p = p // 2
            q = (q - 1) // 2
        if p == q:
            res = self.segfunc(res, self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
        return res
    
    @staticmethod
    def segfunc(a, b):
        return a | b


def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


def solve():
    N = int(input())
    S = input()
    Q = int(input())
    
    init_val = [1 << ord(S[i]) - ord('a') for i in range(N)]
    seg_tree = SegmentTree(N, init_val, 0)
    
    for _ in range(Q):
        cmd, *query = input().split()
        cmd = int(cmd)
        if cmd == 1:
            i = int(query[0]) - 1
            c = query[1]
            seg_tree.update(i, 1 << ord(c) - ord('a'))
        else:
            l = int(query[0]) - 1
            r = int(query[1])
            kind = seg_tree.query(l, r)
            print(popcount(kind))


if __name__ == '__main__':
    solve()


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

int main(void)
{
	string s;
	int sum = 0;

	cin >> s;
	
	for (int i = 0; i < s.size(); i++)
	{
		sum += s[i] - '0';
		sum %= 9;
	}

	if (sum % 9 == 0)
		cout << "Yes";
	else
		cout << "No";

	return 0;
}

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

using namespace std;

#define endl '\n'
#define cw(x) cout << (x) << endl
#define cww(x,y) cout << (x) << ' ' << y << endl
#define cwa(x) for(auto a:x) cout << a << ' ';cout << endl
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef unordered_set<int> usi;
typedef vector<pi> vpi;

int x,i;

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

    for(cin >> x,i=x;i%360!=0;i+=x){}
    cout << i/x << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct CUBE {
    long long x1;
    long long y1;
    long long d1;
    long long x2;
    long long y2;
    long long d2;
    CUBE() {}
    CUBE(long long a,long long b,long long c,long long d,long long e,long long f) {
        this->x1=a; this->y1=b; this->d1=c;
        this->x2=d; this->y2=e; this->d2=f;
    }
};

typedef pair<long long, int> P; // cordinate, index

int main() {
    int N,K;
    cin >> N >> K;

    vector<CUBE> fish;
    vector<P> x,y,z;

    for(int i=0 ;i<N; ++i) {
        long long a,b,c,d,e,f;
        cin >> a >> b >> c >> d >> e >> f;
        fish.push_back(CUBE(a,b,c,d,e,f));
        x.push_back(P(a,i));
        y.push_back(P(b,i));
        z.push_back(P(c,i));
        x.push_back(P(d,i));
        y.push_back(P(e,i));
        z.push_back(P(f,i));
    }

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

    vector<int> rnkx[N];
    vector<int> rnky[N];
    vector<int> rnkz[N];

    long long valx[2*N],valy[2*N],valz[2*N];

    for(int i=0; i<(int)x.size(); ++i) {
        P px=x[i];
        P py=y[i];
        P pz=z[i];
        rnkx[px.second].push_back(i);
        rnky[py.second].push_back(i);
        rnkz[pz.second].push_back(i);
        valx[i]=(i<2*N-1?x[i+1].first-x[i].first:0);
        valy[i]=(i<2*N-1?y[i+1].first-y[i].first:0);
        valz[i]=(i<2*N-1?z[i+1].first-z[i].first:0);
    }

    int mp[2*N][2*N][2*N];

    for(int i=0; i<2*N; ++i) {
        for(int j=0; j<2*N; ++j) {
            fill(mp[i][j],mp[i][j]+2*N,0);
        }
    }

    for(int i=0; i<N; ++i) {
        for(int mpx=rnkx[i][0]; mpx<rnkx[i][1]; ++mpx) {
            for(int mpy=rnky[i][0]; mpy<rnky[i][1]; ++mpy) {
                for(int mpz=rnkz[i][0]; mpz<rnkz[i][1]; ++mpz) ++mp[mpx][mpy][mpz];
            }
        }
    }

    long long ans=0;
    for(int i=0; i<2*N; ++i) {
        for(int j=0; j<2*N; ++j) {
            for(int k=0; k<2*N; ++k) {
                if(mp[i][j][k]>=K) ans+=valx[i]*valy[j]*valz[k];
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int ans = s.length();
    int[] t = new int[s.length()];
    for(int i = 0; i < s.length(); i++) {
      t[i] = Integer.parseInt(String.valueOf(s.charAt(i)));
    }
    for(int i = 0; i < s.length() - 1; i++) {
      if(t[i] != t[i + 1]) ans = Math.min(ans, Math.max(i + 1, s.length() - i - 1));
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 31968
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
    }
    else { // 発見できなかったとき
        return 0;
    }
}

int main(){
    ll a, b;
    cin >> a >> b;
    if(a == 1){
        if(b == 2){
            cout << 3;
        }else{
            cout << 2;
        }
    } else if(a == 2){
        if(b == 1){
            cout << 3;
        }else{
            cout << 1;
        }
    } else {
        if(b == 1){
            cout << 2;
        }else {
            cout << 1;
        }
    }
    
    return 0;
    
}


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

const int maxn=410;
const long long inf=10000000000000;
long long pre[maxn];
long long t[maxn];
long long dp[maxn][maxn];

long long sum(int a, int b) { return pre[b]-pre[a-1]; }

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			dp[i][j]=inf;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&t[i]);
		pre[i]=t[i]+pre[i-1];
		dp[i][i]=0;
	}
	for(int i=1;i<n;i++)
		dp[i][i+1]=t[i]+t[i+1];
	for(int i=3;i<=n;i++)
		for(int j=1;(j+i-1)<=n;j++)
			for(int k=j;k<(j+i-1);k++)
				dp[j][j+i-1]=min(dp[j][k]+dp[k+1][j+i-1]+sum(j,j+i-1),dp[j][j+i-1]);
	printf("%lld",dp[1][n]);
}

Measured memory_bytes: 1536
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

if (a1 > b1 and a2 > b2) or (a1 < b1 and a2 < b2):
  print(0)
else:
  if a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2:
    print("infinity")
  else:
    d_all = (a1 * t1 + a2 * t2) - (b1 * t1 + b2 * t2)
    d_1 = a1 * t1 - b1 * t1
    if (d_all > 0 and d_1 > 0) or (d_all < 0 and d_1 < 0):
      print(0)
    else:
      if abs(d_all) > abs(d_1):
        print(1)
      else:
        ans = 1
        ans += abs(d_1) // abs(d_all) * 2 - (1 if d_1 % d_all == 0 else 0)
        print(ans)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
#ABC084C

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
y=hoge[1]

max10=y//10000
max5=y//5000
max1=y//1000

flg=0
for i in range(0,max10+1):
	for j in range(0,max5+1):
		k=n-i-j
		if(k>=0)and(i*10000+j*5000+k*1000==y):
			flg=1
			break
	else:
		continue
	break
if flg:
	print("{} {} {}".format(i,j,k))
else:
	print("-1 -1 -1")




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

int Par[100001];

void init(int n)
{
	for(int i = 0;i<n;i++)
	{
		Par[i]=i;
	}
}
int find(int x)
{
	if(Par[x]==x)
	{
		return x;
	}
	return Par[x]=find(Par[x]);
}
bool same(int x,int y)
{
	return find(x)==find(y);
}
void unite(int x,int y)
{
	x = find(x);
	y = find(y);
	if(x==y)return;
	Par[x] = y;
}
int main()
{
	ll n,m;
	cin >> n >> m;
	init(n);
	vector<vector<pair<ll,ll>>> g(n);
	vector<ll> dist(n,1e11);//1を0としたときの距離
	stack<ll> S;
	for(ll i = 0;i<m;i++)
	{
		ll l,r,d;
		cin >> l >> r >> d;
		l--;r--;
		
		g[l].emplace_back(r,d);
		g[r].emplace_back(l,-d);
		unite(l,r);
	}
	for(int i = 0;i<n;i++)
	{
		find(i);
		if(find(i)==i)
		{
			S.push(i);
			dist[i]=0;
		}
	}
	while(!S.empty())
	{
		ll now = S.top();
		S.pop();
		for(auto i:g[now])
		{
			if(dist[i.first]==1e11)
			{
				dist[i.first]=dist[now]+i.second;
				S.push(i.first);
			}
			else
			{
				if(dist[i.first]!=dist[now]+i.second)
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using Graph = vector<vector<int>>;


//二項係数を求める。
const int MAX = 210000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


ll f(int n, int m){
  ll tmp = m;
  rep(i,n-1){
    tmp *= (m-1);
    tmp %= MOD;
  }
  return tmp;
}

int main(){
  int N,M,K; cin>>N>>M>>K;
  COMinit();

  ll res = 0, F = 0;
  for(int i = min(N-1,K); i >= 0; i--){
    //iは色ダブりの接点の数。
    if(i==min(N-1,K))F = f(N-i,M);
    else F *= (M-1);
    F %= MOD;
    ll tmp = COM(N-1,i);
    tmp *= F;
    res += tmp;
    res %= MOD;
  }
  cout<<res<<endl;
}

Measured memory_bytes: 8544
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b;
    cin >> a >> b;
    if( a <= 8 && b <= 8 ) cout << "Yay!";
    else cout << ":(";
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    int n,m,sum=0;
    cin >> n >> m;
    vector<int> a(n);  
    FOR(i,0,n) {
        cin >> a.at(i);
        sum += a.at(i);
    }
    bool ans = true;
    sort(a.begin(), a.end(), greater<int>());
    

    FOR(i,0,m){
        if(a.at(i)*(4*m) < sum){
            ans = false;
            break;
        }
    }

    if(ans== true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;

}



Measured memory_bytes: 256
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#if __cplusplus >= 201103
#include <numeric>
#endif
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#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()

//#if __cplusplus >= 201103
typedef long long ll;
//#endif
typedef pair<int, int> P;
typedef pair<int, P> IP;

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

const int INF = 100000000;
//#if __cplusplus >= 201103
const ll LINF = 10000000000000000ll;
//#endif
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
// }}}

int n, m;
int adj[8][8];

void init()
{
}

void solve()
{
    int ans = 0;
    queue<P> q;
    q.push(mp(1, 0));
    while(!q.empty()){
        int visited = q.front().fi;
        int now = q.front().se;
        q.pop();
        if(visited == ((1 << n) - 1)){
            ans++;
        }
        REP(i, n){
            if(adj[now][i] == 1 && !((visited >> i) & 1)){
                q.push(mp((visited | (1 << i)), i));
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    REP(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        adj[a][b] = adj[b][a] = 1;
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


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

ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }
  else{
    return gcd(b,(a%b));
  }
}
ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}

int main() {
  int n;
  cin>>n;
  vector<int> vec(n);
  int mmm=300000;
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  int answer=0;
  for(int i=0;i<n;i++){
    if(vec.at(i)<mmm){
      answer++;
    }
    mmm=min(mmm,vec.at(i));
  }
  cout<<answer<<endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<int,int> c[210000];
int x[210000];
int y[210000];
int d[210000];
int segtree[524288][4];
int query(int a,int b,int c,int d,int e,int f){
	if(d<a||b<c){
		if(f%2)return 0;
		return 999999999;
	}
	if(c<=a&&b<=d){
		return segtree[e][f];
	}
	if(f%2)return max(query(a,(a+b)/2,c,d,e*2,f),query((a+b)/2+1,b,c,d,e*2+1,f));
	return min(query(a,(a+b)/2,c,d,e*2,f),query((a+b)/2+1,b,c,d,e*2+1,f));
}
void update(int a,int b,int c){
	b+=262144;
	while(b){
		if(a%2)segtree[b][a]=max(segtree[b][a],c);
		else segtree[b][a]=min(segtree[b][a],c);
		b/=2;
	}
}
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d%d",x+i,y+i,d+i);
		//printf("%d %d\n",x[i],y[i]);
		c[i]=make_pair(d[i],i);
	}
	std::sort(c,c+a);
	for(int i=0;i<524288;i++){
		segtree[i][0]=segtree[i][2]=999999999;
	}
	for(int i=0;i<a;i++){
		int t=c[i].second;
		update(0,i,x[t]);
		update(1,i,x[t]);
		update(2,i,y[t]);
		update(3,i,y[t]);
	}
	long long ret=0;
	for(int i=0;i<a;i++){
		int to=c[i].first+b;
		int at=lower_bound(c,c+a,make_pair(to+1,0))-c-1;
		int X=query(0,262143,i,at,1,1)-query(0,262143,i,at,1,0);
		int Y=query(0,262143,i,at,1,3)-query(0,262143,i,at,1,2);
	//	printf("%d %d: %d %d\n",i,at,X,Y);
		ret=max(ret,(long long)X*Y);
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 13324
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
    double D = sc.nextDouble();
    double T = sc.nextDouble();
    double S = sc.nextDouble();
    double x = D/S;
    String X = "";
    if (D==0 || T==0 || S == 0){
      X="No";
      return;
    }
    
    if(x<=T) {
      X="Yes";
    } else if (x>T) {
      X="No";
    }
    
    System.out.println(X);
  }
}


Measured memory_bytes: 37148
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (long long int i = f; i < t; i++)
#define pr(i, f, t) for (long long int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
#define ce(a) cout << (a) << endl
int main()
{
    ll n;
    cin >> n;
    string s[n];
    rp(i, 0, n) cin >> s[i];
    set<string> ss;
    rp(i, 0, n) ss.insert(s[i]);
    ce(ss.size());
}

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

int main(){
	long long i,j,n,m;
	cin >> n;
	while(n){
		char c[2][n],p;
		for(i=0;i<n;i++) cin >> c[0][i] >> c[1][i];
		cin >> m;
		for(i=0;i<m;i++) {
			cin >> p;
			for(j=0;j<n;j++) if(p==c[0][j]){p=c[1][j]; break;}
			cout << p;
		}
		cout << endl;
		cin >> n;
	}
	return 0;
}

Measured memory_bytes: 1152
import sys

input = sys.stdin.readline
MOD = 1000000007

S = input()[:-1]

S = list(S)

if S[0] == 'A':
    if 'C' in S[2:-1] and  S.count('C') == 1:
        x = []
        for i in range(1,len(S)):
            if S[i] == 'C':
                continue
            x.append(S[i])
        
        #print(x)
        if str(x).islower():
            print("AC")
            exit()

print("WA")



Measured memory_bytes: 3060
import Text.Regex

main::IO()
main =do
  nk<-getLine
  let n:k:[] =  map read (words nk)::[Int]
  print (solver n k)

solver:: Int -> Int -> Int
solver 0 _ =1
solver 1 k =k
solver n k = (k-1)* solver (n-1) k 

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define f first
#define s second
const int INF = 1000 * 1000 * 1000;
const ll LINF = (ll)INF * INF;
const ll mod = INF + 7;
const double EPS = 1e-9;
int a[10000] , b[10000];
vector<ll> s;
int n;
int main()
{
	//freopen("input.txt" , "r" , stdin);
	scanf("%d" , &n);
	for(int i = 0; i < n; i++)
		scanf("%d" , &a[i]);
	for(int i = 0; i < n; i++)
	{
		scanf("%d" , &b[i]);
		s.pb(b[i] - a[i]);
	}
	ll sum = 0 , sum2 = 0;
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i] < 0)
		{
			sum += s[i];
		}
		else
		{
			sum2 += s[i] / 2;
		}
	}

	if(abs(sum) <= sum2)
	{
		cout << "Yes";
	}
	else
		cout << "No";
}



Measured memory_bytes: 512
require 'set'
MOD = 10**9 + 7

N, M = gets.split.map(&:to_i)
dp = Array.new(N + 1) {0}
dp[0] = 1

broken = Set.new
M.times {broken << gets.to_i}

N.times do |i|
  if i + 1 <= N and not broken.include?(i + 1)
    dp[i + 1] += dp[i]
    dp[i + 1] %= MOD
  end
  if i + 2 <= N and not broken.include?(i + 2)
    dp[i + 2] += dp[i]
    dp[i + 2] %= MOD
  end
end

puts dp[N]

Measured memory_bytes: 9468
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#define INF 1000000000

int top[111];
int bot[111];

int memo[111][111];
int saiki(int st,int en){
	if(st+1 == en)return 0;
	if(memo[st][en]!=0)return memo[st][en];
	
	int cost = INF;
	
	for(int i=st+1;i<en;i++){
		int next = 0;
		next += saiki(st,i);
		next += saiki(i,en);
		next += top[st]*bot[i-1]*top[i]*bot[en-1];
		
		cost = min(next,cost);
	}
	
	return memo[st][en] = cost;
}

int main(){
	int n;
	cin>>n;
	
	rep(i,n)cin>>top[i]>>bot[i];
	
	int ans = saiki(0,n);
	printf("%d\n",ans);
}

Measured memory_bytes: 1184
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#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>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#pragma comment(linker, "/STACK:1024000000,1024000000") 
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define set0(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
using namespace std;
int n,a[100005],s;
vector<int> g[100005];
int dfs(int x,int p){
	int cnt=0,mx=0;
	for(int i=0;i<g[x].size();i++){
		int u=g[x][i];
		if(u==p)continue;
		int t=dfs(u,x);
		cnt+=t;
		mx=max(mx,t);
	}
	if(s==x)return a[x]-cnt;
	if(g[x].size()==1)return a[x];
	if(a[x]*2<cnt || mx>a[x] || a[x]>cnt){
		cout<<"NO\n";
		exit(0);
	}
	return a[x]*2-cnt;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		u--;
		v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(int i=0;i<n;i++){
		if(g[i].size()==1){
			if(dfs(s=i,-1))cout<<"NO\n";
			else cout<<"YES\n";
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 13952
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        
        String buf = line2.replace("ABC","");
        int result = (line2.length() - buf.length()) / 3;
        
        System.out.println(result);
    }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

int main(){
  int N;cin>>N;
  int bits = 0;
  vector<int> A(N);

  rep(i,N){
    int x;cin>>x;
    A[i] = x;
    for(int c=0; c<32; c++){
      if(x & 1<<c){
        bits ^= 1<<c;
      }
    }
  }

  rep(i,N){
    cout<<(A[i]^bits)<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 4044
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  char a;
  cin >> a;
  if (a == 'A') {
    a = 'T';
  } else if (a == 'T') {
    a = 'A';
  }
  if (a == 'C') {
    a = 'G';
  } else if (a == 'G') {
    a = 'C';
  }
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    S = readline().strip()
    N = len(S)

    seq = [1]
    for i in range(N-1):
        if S[i+1] == S[i]:
            seq[-1] += 1
        else:
            seq.append(1)
    
    ans = len(seq) - 1
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3956
#include<iostream>
#include<string>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    string arr[a];
    for(int i=0;i<a;i++)
    {
        cin>>arr[i];
    }
    for(int x=0;x<b+2;x++)
    {
        cout<<"#";
    }
    cout<<endl;
    for(int y=0;y<a;y++)
    {
        cout<<"#";
        cout<<arr[y];
        cout<<"#"<<endl;
    }
    for(int q=0;q<b+2;q++)
    {
        cout<<"#";
    }
    cout<<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 FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

template <typename T>
T modpower(T a, T n, T mod) {
  T res = 1;
  while (n > 0) {
	if (n & 1) res = res * a % mod;
	a = a * a % mod;
	n >>= 1;
  }
  return res;
}

template <typename T>
T modinv(T a, T mod) {
  return modpower(a, mod - 2, mod);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	ll n, a, b;
	cin >> n >> a >> b;
	ll res = modpower((ll)2, n, MOD);
	ll p = 1;
	vector<ll> com(b + 1);
	rep (i, b + 1) {
	  p *= (n - i);
	  p %= MOD;
	  p *= modinv((ll)i + 1, MOD);
	  p %= MOD;
	  com[i + 1] = p;
	}
	res -= com[a];
	if (res < 0) res += MOD;
	res -= com[b];
	if (res < 0) res += MOD;
	cout << res - 1 << endl;
    
    return 0;
}


Measured memory_bytes: 4768
// C - One Quadrillion and One Dalmatians
#include <bits/stdc++.h>
using namespace std;

int main(){
	int64_t n; cin>>n;
	string ans = "";
	while(n){
		n--;
		ans = char(n%26+'a') + ans;
		n /= 26;
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 3624
using System;
using System.Linq;
using System.Collections.Generic;
 
public class Rally
{
 
    public static void Main()
    {
      var N = int.Parse(Console.ReadLine());
      var Xn = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
	  
      double minSt=1000000;
      for(int P=Xn.Min();P<=Xn.Max();P++)
      {
        double h=0;
        foreach(int x in Xn){h+=Math.Pow(x-P,2); }
        if(minSt>h){minSt=h;}
      }

      Console.WriteLine(minSt);
    }
}

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

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

    int res=0;

    while( a>0 || c>0){
        if((c-b)<=0){
            res=1;
            break;
        }
        else if((a-d)<=0){
            res=-1;
            break;
        }
        c = c - b;
        a = a - d;

    }

    if(res==1)
        cout<<"Yes";
    else
        cout<<"No";



}


Measured memory_bytes: 3664