akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  string s;
  while (cin >> s) {
    string key = "keyence";
    bool res = false;
    for (int i = 0; i <= s.size(); i++) {
      for (int j = i; j <= s.size(); j++) {
        string got = s.substr(0, i) + s.substr(j);
        if (got == key) res = true;
      }
    }
    cout << (res ? "YES" : "NO") << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import numpy as np
import math
# for AtCoder
# import fractions
from collections import deque 
from functools import reduce
 
# input = sys.stdin.readline
 
n = input()
 
if (n[0] == '7' or n[1] == '7' or n[2] == '7'):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 26960
import Control.Applicative
main = solve

solve = do
    n <- fmap (read :: String -> Int) . words <$> getLine
    let a = n !! 0
        b = n !! 1
        c = n !! 2
    putResult a b c
    where
        putResult :: Int -> Int -> Int -> IO ()
        putResult a b c
            | a < b && b < c = putStrLn "Yes"
            | otherwise = putStrLn "No"

Measured memory_bytes: 3676
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

string button[10] =
{
    " ",
    "',.!?",
    "abcABC",
    "defDEF",
    "ghiGHI",
    "jklJKL",
    "mnoMNO",
    "pqrsPQRS",
    "tuvTUV",
    "wxyzWXYZ"
};

int main()
{
    for(;;){
        string s;
        if(!(cin >> s))
            return 0;

        int n = s.size();
        int m = 0;
        for(int i=0; i<n; ++i){
            if(i > 0 && ((s[i] == '0' && s[i-1] == '0') || (s[i] != s[i-1] && s[i-1] != '0'))){
                string t = button[s[i-1]-'0'];
                char c = t[(m-1) % t.size()];
                cout << c;
                m = 0;
            }

            if(s[i] != '0')
                ++ m;
        }

        if(m > 0){
            string t = button[s[n-1]-'0'];
            char c = t[(m-1) % t.size()];
            cout << c;
        }

        cout << endl;
    }
}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int m=sc.nextInt();
        
        
        out.println(m>=n?"unsafe":"safe");
     	out.flush();
    }

    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


//class P implements Comparable<P>{
//    int i,x,r,f;
//    P(int i,int x,int r,int f) {
//    	this.i=i;
//    	this.x=x;
//    	this.r=r;
//    	this.f=f;
//    }
//
//    public int compareTo(P p){
//    	if(-this.r+p.r==0) {
//    		return -this.x+p.x;
//    	}
//        return -this.r+p.r;
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 200010

class UnionFind {
    public:
        // size: Union-Find で扱いたい要素の数
        UnionFind(int size) { m_Data.assign(size, -1); }

        // x と y の属する集合を併合
        // 既に一緒な集合内にいるなら false を
        // 新たに併合されたなら true を返す
        bool Unite(int x, int y) {
            x = Find(x), y = Find(y);
            if(x == y) { return (false); }
            if(m_Data[x] > m_Data[y]) { swap(x, y); }
            m_Data[x] += m_Data[y];
            m_Data[y] = x;
            return (true);
        }

        // 要素 k が属する集合の根を返す
        int Find(int k) {
            if(m_Data[k] < 0) { return (k); }
            return (m_Data[k] = Find(m_Data[k]));
        }

        // 要素 k と同じ集合の要素数を返す
        int Size(int k) { return (-m_Data[Find(k)]); }

    private:
        vector<int> m_Data;
};

int N, K, L;
vector<int> graphK[MAX_N];
vector<int> graphL[MAX_N];
UnionFind* pUfK;
UnionFind* pUfL;
UnionFind* pUfAll;

vector<int> group[MAX_N];   // グループ i に所属するノード

void dfs_k(int cur) {
    for(auto& to : graphK[cur]) {
        if(pUfK->Find(cur) == pUfK->Find(to)) { continue; }
        pUfK->Unite(cur, to);
        dfs_k(to);
    }
}
void dfs_l(int cur) {
    for(auto& to : graphL[cur]) {
        if(pUfL->Find(cur) == pUfL->Find(to)) { continue; }
        pUfL->Unite(cur, to);
        dfs_l(to);
    }
}

signed main()
{
    cin >> N >> K >> L;

    REP(i, K) {
        int p, q;
        cin >> p >> q;
        p--; q--;
        graphK[p].push_back(q);
        graphK[q].push_back(p);
    }
    REP(i, L) {
        int r, s;
        cin >> r >> s;
        r--; s--;
        graphL[r].push_back(s);
        graphL[s].push_back(r);
    }
    UnionFind ufk(N);
    UnionFind ufl(N);
    UnionFind ufall(N);
    pUfK = &ufk;
    pUfL = &ufl;
    pUfAll = &ufall;
    REP(i, N) { if(ufk.Size(i) == 1) { dfs_k(i); } }
    REP(i, N) { if(ufl.Size(i) == 1) { dfs_l(i); } }
    REP(i, N) { group[ufl.Find(i)].push_back(i); }
    REP(i, N) {
        if(ufall.Size(i) == 1 && ufk.Size(i) > 1 && ufl.Size(i) > 1) {
            for(auto& n : group[ufl.Find(i)]) {
                if(ufk.Find(i) == ufk.Find(n)) { ufall.Unite(i, n); }
            }
        }
    }
    REP(i, N) {
        printf("%lld", ufall.Size(i));
        if(i == N-1) { printf("\n"); }
        else { printf(" "); }
    }
    return 0;
}


Measured memory_bytes: 30580
import java.util.*;

public class Main {
	public static void main(String[] args){
 
        Scanner sc = null;
        sc = new Scanner(System.in);
        double d = sc.nextInt();
        int t = sc.nextInt();
        double s = sc.nextInt();
        sc.close();

        if (d / s <= t) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } 
      }
}

Measured memory_bytes: 35592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	double n,m;
	cin>>n>>m;
	double sum=m*1900+(n-m)*100;
	double ans=0.1;
	double now=1,POW=pow(double(0.5),m);
	for(double i=0;i<10000000;i++){
		double NOW=now*POW;
		now=now-NOW;
		//cout << sum<<endl;
		ans+=(i+1)*sum*NOW;
		//cout << ans<<endl;
	}
	cout << ll(ans);
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(void) {
	int h, w;
	for (;;) {
		std::cin >> h >> w;
		if (h == 0 && w == 0) { break; }
		for (int y = 0; y < h; ++y) {
			for (int x = 0; x < w; ++x) {
				std::cout << "#";
			}
			std::cout << "\n";
		}
		std::cout << std::endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

ll dp[1005][1005];
char a[10005][1005];
ll mod = 1e9 + 7;

int main(int argc, char *argv[])
{
	int H, W;

	cin >> H >> W;

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i][j];
		}
	}

	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (a[i][j] == '#') {
				continue;
			}

			if (j - 1 >= 0) {
				dp[i][j] += dp[i][j - 1];
				dp[i][j] %= mod;
			}
			if (i - 1 >= 0) {
				dp[i][j] += dp[i - 1][j];
				dp[i][j] %= mod;
			}
		}
	}

	cout << dp[H - 1][W - 1] << endl;

	return 0;
}

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

using namespace std;

int main()
{
  int a[6];
  for(int i=1;i<=5;i++)
  {
    cin>>a[i];
  }
  for(int i=1;i<=5;i++)
  {
    //cout<<a[i]<<" ";
    if(a[i]==0)
        cout<<i<<" ";
  }
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cmath>

using ll = long long;
const ll INF = __LONG_LONG_MAX__;

using namespace std;

int main() {
    int N;
    cin >> N;
    int p[N], q[N];
    for(int i = 0; i < N; i++) {
        cin >> p[i];
        q[i] = p[i];
    }
    sort(q, q+N);
    int count = 0;
    for(int i = 0; i < N; i++) {
        if(p[i] != q[i]) {
            count++;
        }
    }

    if(count <= 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::collections::HashSet;

fn main() {
    let s = get!(String).chars().collect::<Vec<_>>();
    let (mut x, y) = get!(i32, i32);

    let mut n = 0;
    let mut d: i32 = 0;
    let mut xx = Vec::new();
    let mut yy = Vec::new();
    for c in s {
        if c == 'F' {
            d += 1;
        } else {
            if n == 0 {
                x -= d;
            } else if d != 0 {
                if n%2 == 0 {
                    xx.push(d);
                } else {
                    yy.push(d);
                }
            }
            d = 0;
            n += 1;
        }
    }
    if n == 0 {
        x -= d;
    } else if d != 0 {
        if n%2 == 0 {
            xx.push(d);
        } else {
            yy.push(d);
        }
    }

    let mut xs = HashSet::new();
    xs.insert(0);
    for x in xx.into_iter() {
        let mut xxs = HashSet::new();
        for &xx in &xs {
            xxs.insert(xx + x);
            xxs.insert(xx - x);
        }
        xs.clear();
        for &xx in &xxs {
            xs.insert(xx);
        }
    }

    if !xs.contains(&x) {
        println!("No");
        return;
    }

    let mut ys = HashSet::new();
    ys.insert(0);
    for y in yy.into_iter() {
        let mut yys = HashSet::new();
        for &yy in &ys {
            yys.insert(yy + y);
            yys.insert(yy - y);
        }
        ys.clear();
        for &yy in &yys {
            ys.insert(yy);
        }
    }

    println!("{}", if ys.contains(&y) { "Yes" } else { "No" });
}

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

int main(){
    
    int n, d, x;
    cin>>n>>d>>x;
    long total=x;
    for (int i=0; i<n; i++){
        double a;
        cin>>a;
        total+=ceil(d/a);
    }
    cout<<total<<"\n";
}

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

int main() 
{
	int arr [3] ;
	for(int i = 0 ; i < 3 ; i++)
	{
		scanf("%d" , &arr[i]) ;
	}
	sort(arr , arr+3) ;
	int y = arr[2]*10 + arr[1] ;
	int x = y + arr[0] ;
	printf("%d\n" , x) ;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

  cin >> n;
  vector<int> l(n);
  REP(i, n) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());

  int ans = 0;
  REP(i, n) {
    FOR(j, i + 1, n) {
      int mi = abs(l[i] - l[j]);
      int ma = l[i] + l[j];

      auto itmi = upper_bound(l.begin() + j, l.end(), mi);
      auto itma = lower_bound(l.begin() + j, l.end(), ma);
      if(itmi != l.end()) {
        int mi_i = itmi - l.begin();
        int ma_i = itma - l.begin() - 1;
        if(mi_i < ma_i) {
          ans += ma_i - mi_i;
        }
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long solve(vector<int>arr,int n){
	stack<int>s;
	s.push(arr[0]);
	long long res=0;
	for(int i=1;i<n;i++){
		while(!s.empty()&&s.top()<=arr[i])
			s.pop();
		if(!s.empty()){
			res+=s.top()-arr[i];
			arr[i]=s.top();
		}
		s.push(arr[i]);
	}
	return res;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;cin>>n;
	vector<int>arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	cout<<solve(arr,n)<<'\n';
	return 0;
}

Measured memory_bytes: 5552
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

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

int buy_A(int n){
	return 5*380*0.80*(int)(n/5) + 380 * (n%5);
}

int buy_B(int n){
	return 4*550*0.85*(int)(n/4) + 550 * (n%4);
}

int buy_C(int n){
	return 3*850*0.88*(int)(n/3) + 850 * (n%3);
}

int main(){
	int W;
	while(~scanf("%d",&W)){
		if(W==0) break;
		W/=100;
		int res=numeric_limits<int>::max();

		for(int a=0; a<=25;a++){
			for(int b=0; b<=17;b++){
				for(int c=0; c<=10;c++){
					if(a*2+b*3+c*5 - W == 0){
						res = min(res,buy_A(a)+buy_B(b)+buy_C(c));
					}

				}
			}

		}

		cout << res << endl;

	}
}

Measured memory_bytes: 0
#ifndef ONLINE_JUDGE
    #include "debug.cpp"
#endif

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define int long long

const int inf = 1e18 + 5;

void solve()
{
    int x;
    cin >> x;
    cout << (x ^ 1) << endl;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p,l,r;
};
struct Node T[MAX];
int n;

void preParse(int u){
  if(u==NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u==NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u==NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL) T[l].p=v;
    if(r!=NIL) T[r].p=v;
  }
  
  for(i=0;i<n;i++) if(T[i].p==NIL) root=i;
  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}



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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int N, K;

template <class T>
class SegTree{
    int n;
    vector<T> data;
    T def; //初期値,単位元
    function<T(T, T)> operation; //区間クエリで使う処理
    function<T(T, T)> update; //1点更新で使う処理

    //区間[a,b)の総和
    T _query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return def; //交差しない時
        if(a <= l && r <= b) return data[k]; //[l,r)が完全に含まれるとき
        else{
            T c1 = _query(a, b, (k << 1)+1, l, (l+r)/2);
            T c2 = _query(a, b, (k << 1)+2, (l+r)/2, r);
            return operation(c1, c2);
        }
    }

  public:
    // _n:必要サイズ _def:初期値かつ単位元 _operation:クエリ関数
    // _update:更新関数
    SegTree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
        : def(_def), operation(_operation), update(_update){
        n = 1;
        while(n < _n){
            n *= 2;
        }
        data = vector<T>(2*n-1, def);
    }

    //場所i(0-idx)の値をxで更新
    void change(int i, T x){
        i += n-1;
        data[i] = update(data[i], x);
        while(i > 0){
            i = (i-1)/2;
            data[i] = operation(data[(i<<1) + 1], data[(i<<1) + 2]);
        }
    }

    T query(int a, int b){
        return _query(a, b, 0, 0, n);
    }

    T operator[](int i){
        return data[i+n-1];
    }
};

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> K;
    vector<int> A(N); rep(i, N) cin >> A[i];
    SegTree<int> st(500000, 0,
                        [](int a, int b){return max(a, b);},
                        [](int a, int b){return b;});
    rep(i, N){
        int left = max(0, A[i]-K);
        int right = min(400000, A[i]+K);
        int temp = st.query(left, right+1);
        st.change(A[i], temp+1);
    }
    cout << st.query(0, 400000) << endl;
    return 0;
}

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

int main() {
   int H, W;
   cin >> H >> W;

   char temp[H][W];
   bool bh[H], bw[W];

   for (int h = 0; h < H; h++) {
      for (int w = 0; w < W; w++) {
         cin >> temp[h][w];
      }
   }
   
   for (int h = 0; h < H; h++) {
      bh[h] = false;
      for (int w = 0; w < W; w++) {
         if (temp[h][w] == '#') bh[h] = true;
      }
   }
   for (int w = 0; w < W; w++) {
      bw[w] = false;
      for (int h = 0; h < H; h++) {
         if (temp[h][w] == '#') bw[w] = true;
      }
   }

   for (int h = 0; h < H; h++) {
      if (bh[h] == true) {
         for (int w = 0; w < W; w++) {
            if (bw[w] == true) cout << temp[h][w];
         }
         cout << endl;
      }
   }

   return 0;
}


Measured memory_bytes: 256
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	char c;
	cin>>c;
	if(c>='A'&&c<='Z')cout<<'A';else cout<<"a";
	return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "B"
int n, m, k;
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    cin>>n>>m>>k;
    FOR(i, 0, n) FOR(j, 0, m){
        if(i*m+j*(n-i)-i*j==k){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    long t1, t2, a1, a2, b1, b2;
    void run() {
        Scanner sc = new Scanner(System.in);

        t1 = sc.nextLong();
        t2 = sc.nextLong();
        a1 = sc.nextLong();
        a2 = sc.nextLong();
        b1 = sc.nextLong();
        b2 = sc.nextLong();

        if (t1 * a1 + t2 * a2 == t1 * b1 + t2 * b2) {
            System.out.println("infinity");
            return;
        }

        if (t1 * a1 < t1 * b1 && t1 * a1 + t2 * a2 < t1 * b1 + t2 * b2) {
            System.out.println(0);
            return;
        }

        if (t1 * b1 < t1 * a1 && t1 * b1 + t2 * b2 < t1 * a1 + t2 * a2) {
            System.out.println(0);
            return;
        }

        long d = Math.abs(t1 * a1 + t2 * a2 - t1 * b1 - t2 * b2);
        debug(d, t1 * a1, t1 * b1, t1 * a1 + t2 * a2, t1 * b1 + t2 * b2);
        long d2 = Math.abs(t2 * a2 - t2 * b2);
        long d1 = Math.abs(t1 * a1 - t1 * b1);
        debug(d, d1, d2, t1 * a1, t1 * b1, t1 * a1 + t2 * a2, t1 * b1 + t2 * b2);


        long cnt = 2 * (d1 / d) + 1;

        if (d1 % d == 0) cnt--;

        System.out.println(cnt);
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

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

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

//https://atcoder.jp/contests/abc136/tasks/abc136_d

int main() {
    string s;
    cin >> s;
    vector<int> n(1, 0);
    int cnt = 1;
    rep(i, 0, s.size() - 1) {
        if (s[i] == s[i + 1]) {
            cnt++;
        } else {
            n.push_back(cnt);
            cnt = 1;
        }
    }
    n.push_back(cnt);

    vector<int> ans(s.size(), 0);
    int ridx = -1;
    int lidx = 0;
    rep(i, 1, n.size() - 1)
    {
        if (i % 2 == 1) {
            ridx += n[i] + n[i - 1];
            lidx += n[i] + n[i - 1];
            ans[ridx] += (n[i]  + 1) / 2;
            ans[lidx] += n[i] / 2;
            ans[ridx] += n[i + 1] / 2;
            ans[lidx] += (n[i + 1] + 1) / 2;
        }
    }

    for (auto &&i : ans)
    {
        cout << i << " ";
    }
    cout << endl;

}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007;
#define INF 10*60;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

int calc_digit(long long n) {
    int res = 0;
    while (n > 0) {
        ++res;
        n /= 10;
    }
    return res;
}

signed main(){
  int N;cin>>N;
  int res=INF;
  for(int a=1;a*a<=N;a++){
    if(N%a!=0)continue;
    int b=N/a;
    int tmp=max(calc_digit(b),calc_digit(a));
    res=min(tmp,res);
  }
  print(res)

  
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;
int h[110];
int x[110];
int y[110];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> h[i];
  }

  for (int pos_y = 0; pos_y <= 100; pos_y++) {
    for (int pos_x = 0; pos_x <= 100; pos_x++) {
      // 0以上: 暫定のH
      // -1: まだわからない時
      // -2: だめだとわかった時
      int H_tmp = -1;
      for (int i = 0; i < N; i++) {
        if (h[i] > 0) {
          int H_cal = h[i] + abs(y[i] - pos_y) + abs(x[i] - pos_x);
          if (H_tmp == -1) {
            H_tmp = H_cal;
          } else {
            if (H_cal != H_tmp) {
              H_tmp = -2;
              break;
            }
          }
        }
      }
      // だめだったら次の場所を探す
      if (H_tmp == -2) {
        continue;
      }
      for (int i = 0; i < N; i++) {
        // 高さ0の場合に矛盾していないか調べる
        if (h[i] == 0) {
          int d = abs(y[i] - pos_y) + abs(x[i] - pos_x);
          if (H_tmp > d) {
            H_tmp = -2;
            break;
          }
        }
      }
      if (H_tmp == -2) {
        continue;
      }
      cout << pos_x << " " << pos_y << " " << H_tmp << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=998244353;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

map<string,int>has;
void Solve(){
  int n;
  cin>>n;
  rep(i,1,n){
    string str;
    cin>>str;
    has[str]++;
  }
  cout<<"AC x "<<has["AC"]<<endl;
  cout<<"WA x "<<has["WA"]<<endl;
  cout<<"TLE x "<<has["TLE"]<<endl;
  cout<<"RE x "<<has["RE"]<<endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<numeric>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    vector<int> y(m);
    bool start = false;
    vector<bool> flg(n+1, false);
    flg[1] = true;
    int ans = 1;
    vector<int> rest_num(n+1, 1);
    rep(i, m) cin >> x[i] >> y[i];
    rep(i, n) rest_num[i] = 1;
    rep(i, m) {
        --rest_num[x[i]];
        ++rest_num[y[i]];
        if ( flg[x[i]] ) {
            if ( !flg[y[i]]) {
                ++ans;
                flg[y[i]] = true;
            }
        }
        if ( rest_num[x[i]] == 0 ) {
            if ( flg[x[i]] ) {
                --ans;
                flg[x[i]] = false;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>

int ru4(int n){
	int i,r=1;
	for(i=0;i<n;i++)r=r*4;
	return r;
}

int main(){
	int n,a,b,c,i,l[10],j,ans=200000;
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for(i=0;i<n;i++)scanf("%d",&l[i]);
	l[n]=0;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(l[i]<l[j]){
				int tmp=l[i];
				l[i]=l[j];
				l[j]=tmp;
			}
		}
	}
	if(a<=l[0]){
		printf("%d\n",l[0]+l[1]+l[2]-a-b-c);
		return 0;
	}
	for(i=0;i<ru4(n);i++){
		int tmp[10]={0},icp=i;j=0;
		while(icp>0){
			tmp[j]=icp%4;
			icp=(icp-tmp[j])/4;
			j++;
		}
		int abcc[3][10],ac[3]={0};
		for(j=0;j<n;j++){
			if(tmp[j]>0){
				abcc[tmp[j]%3][ac[tmp[j]%3]++]=l[j];
			}
		}
//		for(j=0;j<n;j++)printf("%d",tmp[j]);printf(",%d%d%d",ac[0],ac[1],ac[2]);puts("");
		if(ac[0]>0&&ac[1]>0&&ac[2]>0){
			int ansp,ttmp=0;
			ansp=(ac[0]-1+ac[1]-1+ac[2]-1)*10;
			for(j=0;j<ac[0];j++){
				ttmp+=abcc[0][j];
			}
			ansp+=abs(ttmp-a);ttmp=0;
			for(j=0;j<ac[1];j++){
				ttmp+=abcc[1][j];
			}
			ansp+=abs(ttmp-b);ttmp=0;
			for(j=0;j<ac[2];j++){
				ttmp+=abcc[2][j];
			}
			ansp+=abs(ttmp-c);
			if(ans>ansp)ans=ansp;
//			printf("%d\n",ansp);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
//#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if((a+b)>=m)return (a+b)%m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

int main()
{
    
    char a;cin>>a;
    if(a>='A' && a<='Z')
        cout<<"A";
    else cout<<"a";
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define inf 1010000000
#define infll 1010000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define N 2000009
using namespace std;

ll n,m,sum,ans,f[N];
struct node{ ll b,l,r,d; }a[N];
bool cmp(node a,node b){ return a.d>b.d; }
int main(){
	scanf("%lld%lld",&n,&m);
	int i;
	for (i=1;i<=n;++i){
		scanf("%lld%lld%lld",&a[i].b,&a[i].l,&a[i].r);
		a[i].d=a[i].b*a[i].l+(m-a[i].b)*a[i].r;
		sum+=a[i].b*a[i].l;
	}
	sort(a+1,a+n+1,cmp);
	for (i=1;i<=n;++i) f[i]=f[i-1]+a[i].d;
	ans=n*m;
	for (i=1;i<=n;++i){
		if (f[i]>=sum){
			ll l=1,r=i-1,tmp=0;
			while (l<=r){
				ll mid=(l+r)>>1;
				if (a[i].d+f[mid]>=sum){tmp=mid; r=mid-1;}
				else l=mid+1;
			}
			ll s=sum;
			s-=f[tmp];
			if (s<0) continue;
			ans=min(ans,tmp*m+(s+a[i].l-1)/a[i].l);
			ans=min(ans,tmp*m+(s+a[i].b*(a[i].r-a[i].l)+a[i].r-1)/a[i].r);
		}
		else{
			ll l=i+1,r=n,tmp=0;
			while (l<=r){
				ll mid=(l+r)>>1;
				if (f[mid]>=sum){tmp=mid; r=mid-1;}
				else l=mid+1;
			}
			ll s=sum;
			s-=f[tmp]-a[i].d;
			if (s<0) continue;
			dn(ans,(tmp-1)*m+(s+a[i].l-1)/a[i].l);
			dn(ans,(tmp-1)*m+(s+a[i].b*(a[i].r-a[i].l)+a[i].r-1)/a[i].r);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6400
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 200010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main() {
    ll N, x;
    cin >> N >> x;
    ll a[MAX];
    ll i;
    
    for(i=1; i<2*N; i++) {
        a[i]=i;
    }
    
    if(x==1 || x==2*N-1) {
        puts("No");
    }else {
        puts("Yes");
        if(x==2) {
            swap(a[2], a[N]);
            swap(a[1], a[N-1]);
        }else if(x==2*N-2) {
            swap(a[x], a[N]);
            swap(a[N+1], a[2*N-1]);
        }
        else {
            swap(a[x], a[N]);
            swap(a[1], a[N-1]);
            swap(a[2*N-1], a[N+1]);
            
            if(N-2==2) {
                swap(a[2], a[N+2]);
            }else {
                swap(a[2], a[N+2]);
                swap(a[2*N-2], a[N-2]);
            }
        }
        
        for(i=1; i<2*N; i++)
            pr(a[i]);
    }
    
    
    
}


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

struct UnionFind {
    vector<int> par;
    UnionFind(int n) : par(n, -1){}

    int root(int x) {
        if(par[x]<0) return x;
        return par[x] = root(par[x]);
    }

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

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x==y) return false;
        if(x>y) swap(x, y);
        par[x]+=par[y];
        par[y] = x;
        return true;
    }

    int size(int x){
        return -par[root(x)];
    }
};


int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<set<int>> dame(n);
    UnionFind uf(n);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        dame[a].insert(b);
        dame[b].insert(a);
        uf.unite(a, b);
    }

    rep(i,k) {
        int c, d;
        cin >> c >> d;
        c--; d--;
        if(!uf.same(c, d)) continue;
        dame[c].insert(d);
        dame[d].insert(c);  
    }

    rep(i,n) {
        int ans = uf.size(i)-1;
        ans -= dame[i].size();
        cout << ans << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 26984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

bool ch[3];
int main() {
	for(ll i=0;i<2;i++){
		ll x;
		cin>>x;
		x--;
		ch[x]=true;
	}
	for(ll i=0;i<3;i++){
		if(ch[i]!=true){
			cout << i+1;
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
A = Counter(list(map(int, input().split())))
E = [0, 0]
for k, v in A.items():
    if v>=2:
        E.append(k)
    if v>=4:
        E.append(k)
E.sort()
print(E[-1]*E[-2])

Measured memory_bytes: 18592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class Main {

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

		int n = Integer.parseInt(br.readLine());

		HashMap<String, Integer> map = new HashMap<String, Integer>();

		for(int i = 0; i < n; i++){
			String str = br.readLine();
			char[] cArray = str.toCharArray();
			Arrays.sort(cArray);
			String sorted = new String(cArray);

			if(!map.containsKey(sorted)){
				map.put(sorted, 1);
			}
			else {
				map.put(sorted, map.get(sorted) + 1);
			}
		}

		Set<String> set = map.keySet();

		Iterator<String> it = set.iterator();

		long result = 0;
		while(it.hasNext()){
			String key = it.next();
			long tmp = map.get(key);
//			System.out.println(key + " count "+map.get(key));

			result += tmp*(tmp - 1)/2;
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 47060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ull  unsigned long long
#define vll  vector <long long>
#define pll pair <long long,long long>
#define f first
#define s second
#define up upper_bound
#define lp lower_bound
#define pq priority_queue
#define inf 1e10
#define minf -1e10
#define pi 3.14159265
#define mod 300000000000000000
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);
int main()
{
    string str;
    cin>>str;
    cout<<str[0]<<str[1]<<str[2];
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

void upd(int &ans, int x, int y, int add) {
    if (x <= y) ans = min(ans, y - x + add);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    int ans = 2e9 + 100;
    upd(ans, x, y, 0);
    upd(ans, x, -y, 1);
    upd(ans, -x, y, 1);
    upd(ans, -x, -y, 2);
    cout << ans << '\n';
}


Measured memory_bytes: 256
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300IQ as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         HashMap<String, Integer> map = new HashMap<String, Integer>();
         map.put("AC",0); map.put("WA",0); map.put("RE",0); map.put("TLE",0);
         for(int i=0; i < N; i++)
         {
            String key = infile.readLine();
            if(!map.containsKey(key))
               map.put(key, 0);
            map.put(key, map.get(key)+1);
         }
         print("AC", map);
         print("WA", map);
         print("TLE", map);
         print("RE", map);
      }
      public static void print(String key, HashMap<String, Integer> map)
      {
         System.out.println(key+" x "+map.get(key));
      }
   }

Measured memory_bytes: 44520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) sort(v.begin(), v.end())
typedef long long ll;
using Graph = vector<vector<int>>;

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


Measured memory_bytes: 3632
n = int(input())
p = list(map(int, input().split()))


mi = 0
ma = 0
count = 0

for i in range(1,n-1):
    mi = min(p[i-1],p[i],p[i+1])
    ma = max(p[i-1],p[i],p[i+1])
    if(mi != p[i] and ma != p[i]):
        count += 1

print(count)


Measured memory_bytes: 3060
/*
 * ALDS1_8_A.cpp
 *
 *  Created on: May 2, 2018
 *      Author: 13743
 */

#include<cstdio>
#include<cstdlib>

struct Node {
	int key;
	Node *pa, *lc, *rc;
};

Node* root = NULL;

void insert(int k) {
	Node* y = NULL;
	Node* x = root;
	Node* z = new Node;
	while(x != NULL) {
		y = x;
		if(k < y->key) x = y->lc;
		else x = y->rc;
	}
	z->pa = y;
	z->lc = NULL;
	z->rc = NULL;
	z->key = k;
	if(y == NULL) {
		root = z;
	}
	else if(k < y->key) {
		y->lc = z;
	}
	else {
		y->rc = z;
	}
}

void preorder(Node* u) {
	if(u == NULL) return;
	printf(" %d", u->key);
	preorder(u->lc);
	preorder(u->rc);
}

void inorder(Node* u) {
	if(u == NULL) return;
	inorder(u->lc);
	printf(" %d", u->key);
	inorder(u->rc);
}

void print() {
	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
}

int main() {
	int m;
	scanf("%d", &m);
	char s[100];
	int ke;
	for(int i=0; i<m; i++) {
		scanf("%s", s);
		if(s[0] == 'i') {
			scanf("%d", &ke);
			insert(ke);
		}
		else {
			print();
		}
	}
}





Measured memory_bytes: 26096
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

ll dp[20][20], X[20][20];
int solve_testcase() {
    int A, B; scanf("%d%d", &A, &B);
    if(A == 0 and B == 0) return 1;

    fill(dp[0], dp[A+1], 0);
    fill(X[0], X[A+1], 0);
    int N; scanf("%d", &N);
    for(int i=0; i<N; i++) {
        int x, y; scanf("%d%d", &x, &y);
        x--; y--;
        X[x][y] = 1;
    }
    
    dp[0][0] = !X[0][0];
    for(int i=0; i<A; i++) {
        for(int j=0; j<B; j++) {
            if(X[i][j] == 1) continue;
            if(i+1<A and !X[i+1][j]) dp[i+1][j] += dp[i][j];
            if(j+1<B and !X[i][j+1]) dp[i][j+1] += dp[i][j];
        }
    }

    cout << dp[A-1][B-1] << endl;
    return 0;
}

int main() {
    while(!solve_testcase());
    return 0;
}



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

int m, n;
int ans[150];

int dp[2050][2050]; // S?????????????????£??????

using Set = bitset<12>;

int rec(int asked, int answer){ // ??????????????????aked???answer??¨??????????????????
    int &res = dp[asked][answer];
    if(res != -1) return res;
    res = m;
    int rem = 0;
    for(int i = 0; i < n; ++i){
        if((ans[i] & asked) == answer){
            ++rem;
        }
    }
    if(rem <= 1) return res = 0;

    for(int i = 0; i < m; ++i){
        if(asked >> i & 1) continue;
        int cnt[2] = {};
        for(int j = 0; j < n; ++j){
            if((ans[j] & asked) == answer){
                ++cnt[ans[i] >> j & 1];
            }
        }
        // if(cnt[0] == 0 || cnt[1] == 0) continue;
        int tmp = 0;
        for(int j = 0; j < 2; ++j){
            tmp = max(tmp, 1 + rec(asked | 1<<i, answer | (j << i)));
        }
        res = min(res, tmp);
    }
    return res;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    while(cin >> m >> n && m){
        for(int i = 0; i < n; ++i){
            char buf[100];
            cin >> buf;
            ans[i] = 0;
            for(int j = 0; j < m; ++j){
                if(buf[j]-'0') ans[i] |= 1 << j;
            }
        }
        memset(dp,-1,sizeof(dp));
        cout << rec(0,0) << endl;
    }
}

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

int main()
{
    int i=1,ans,X,Y,Z;
    cin>>X>>Y>>Z;

    while(i<=150000)
    {
        ans=X+X*i;
        if(ans%Y==Z)
        {
            cout<<"YES"<<endl;
            return 0;
        }
        i++;
    }
    cout<<"NO"<<endl;
}


Measured memory_bytes: 256