akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int N = 2000;
const int mo = 1e9 + 9;
const int oo = 0x3f3f3f3f;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

char s[1000];
int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif 

    scanf("%s", s);
    REP(i, 0, strlen(s) - 1) {
        if(s[i] == 'A' && s[i+1] == 'C') return !puts("Yes");
    }
    puts("No");
    return 0;
}


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

int main(void) {
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if((a1+a2+a3) > 21) {
        cout << "bust\n";
    } else {
        cout << "win\n";
    }
    return 0;
}


Measured memory_bytes: 256
// 22
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  int n;
  cin >> n;
  assert(n >= 2);
  vector<li> h(n);
  rep(i, n) cin >> h[i];
  vector<li> mem(n, -1);
  mem[n - 1] = 0;
  mem[n - 2] = abs(h[n - 2] - h[n - 1]);
  function<li(li)> fcost = [&](int pos) -> li {
    if (mem[pos] != -1) return mem[pos];
    return mem[pos] = min(abs(h[pos] - h[pos + 1]) + fcost(pos + 1),
                          abs(h[pos] - h[pos + 2]) + fcost(pos + 2));
  };
  cout << fcost(0) << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0);
  return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 5760
s = str(input())
o = set()
e = set()
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] in ["R","U","D"]:
            pass
        else:
            print("No")
            exit()
    else:
        if s[i] in ["L","U","D"]:
            pass
        else:
            print("No")
            exit()
print("Yes")

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

int main()
{
  int n;
  int tmp;
  int min, max;
  long int sum;
  min = 1000000;
  max = -1000000;
  sum = 0;

  cin >> n;

  for(int i; i<n; i++){
    cin >> tmp;
    sum += tmp;
    if(min > tmp)min = tmp;
    if(max < tmp)max = tmp;
  }

  cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3116
using System;
using System.Collections.Generic;
 
namespace AizuOnLine
{
    class Program
    {
 
        static void Main(string[] args)
        {
            //???????????????
            int n = Convert.ToInt32(Console.ReadLine());
            var hash = new HashSet<string>();
 
            for (int i = 0; i < n; i++)
            {
                string card = Console.ReadLine();
                hash.Add(card);
            }
 
            foreach (string symbol in new string[] { "S", "H", "C", "D" })
            {
                for (int num = 1; num <= 13; num++)
                {
                    string card = symbol + " " + num.ToString();
 
                    if (!hash.Contains(card))
                    {
                        Console.WriteLine(card);
                    }
                }
            }
 
        }
    }
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<bool> Snuke(N, false);
    for(int i = 0; i < K; ++i) {
        int d, a;
        cin >> d;
        for(int j = 0; j < d; ++j) {
            cin >> a;
            Snuke[a-1] = true;
        }
    }
    int res = 0;
    for(auto p : Snuke)
    {
        if(!p) ++res;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3588
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,l=INTM()
    s=[]
    for i in range(n):
        s.append(STR())
    s.sort()
    print(*s,sep='')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int qp(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
signed main()
{
	int n;
	cin>>n;
	cout<<((qp(10,n)-2*qp(9,n)+qp(8,n))%mod+mod)%mod;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;


ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
bool root(string s){
    int n=s.length();
    if(n==2){
        if(s[0]==s[1]){
            return true;
        }
        else return false;
    }
    if(n==3){
        if(s[0]==s[2]){
            return true;
        }
        else return false;
    }
 
    return false;
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

//深さ優先
vector<int> seen;
vector<ll> h;
 
//普通の深さ優先探索seenを返す感じ
void dfs(const Graph &G,int v){

    seen[v] = 0; //v探索済み
 
    P good=make_pair(v,h[v]);
    for(auto next_v :G[v]){
        if(seen[next_v]!=-1) continue;//もう探索していた
        if(h[next_v]>good.second){
            good=make_pair(next_v,h[next_v]);
        }
        dfs(G,next_v);
    }
 
    if(!(h[v]==good.second && v==good.first)){
        seen[good.first]=1;
    }
}


int n;

void dfs(string s, char mx){
    if(s.length()==n){
        cout<<s<<endl;
    }else{
        for(char c='a';c<=mx;c++){
            dfs(s+c,((c==mx) ? (char)(mx+1) : mx));
        }
    }
}
vector<int> dsy(vector<int>dis,vector<vector<pair<int,int>>> g,int start,int goal){
    int n=dis.size();
    priority_queue<pair<int64_t,int64_t>,vector<pair<int64_t,int64_t>>,greater<pair<int64_t,int64_t>>> Q;
    dis[start]=0;
    Q.push(make_pair(0,start));

    while(!Q.empty()){
        int pos=Q.top().second;Q.pop();
        for(int i=0;i<g.at(pos).size();i++){
            int to=g.at(pos).at(i).first;
            int cost=g.at(pos).at(i).second;
            if(dis[to]==-1||dis[to]>dis[pos]+cost){
                dis[to]=dis[pos]+cost;
                Q.push(make_pair(dis[to],to));
            }
        }
    }
    return dis;
}

const long double PI=3.14159265358979323846;
signed main(){ 
    int n,m; cin>>n>>m;
    vector<vector<pair<int,int>>> G(n);
    vector<int> dis(n);
    rep(i,0,n) dis[i]=-1;
    dis[0]=0;
    rep(i,0,m){
        int ai,bi;
        cin>>ai>>bi;
        G[ai-1].push_back(make_pair(bi-1,1));
        G[bi-1].push_back(make_pair(ai-1,1));
    }

    dis=dsy(dis,G,0,0);
    int res[n];
    bool able=true;

    for(int i=1;i<n;i++){
        bool poss=false;
        for(auto p:G[i]){
            if(dis[p.first]+1==dis[i]){
                res[i]=p.first+1;
                poss=true;
                break;
            }
        }
        if(poss==false){
            able=false;
            break;
        }
    }

    if(able==false){
        cout<<"No"<<endl;
        return 0;
    }

    cout<<"Yes"<<endl;
    for(int i=1;i<n;i++){
        cout<<res[i]<<endl;
    }
}  

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define MIN(c) (*min_element(ALL(c))) 
#define MAX(c) (*max_element(ALL(c)))
#define ACC(c) (accumulate(ALL(c), 0))
#define MP(a, b) (make_pair((a), (b)))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
template<typename T> inline void swap(T& a, T& b) {T tmp = a; a = b; b = tmp;}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    double S = ((double)W / 2.0) * (double)H;
    printf("%.9f", S);
    if(x == W / 2 && W % 2 == 0 && y == H / 2 && H % 2 == 0) printf(" 1\n");
    else printf(" 0\n");
    return 0;    
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
  private static boolean solve(int n) {
    return n % 10 == n / 100;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    out.println(solve(n) ? "Yes" : "No");
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 22484
using System;
using System.Collections.Generic;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            // 蒼いカードを読み込む
            var blueCardCount = int.Parse(Console.ReadLine());
            var blueCards = new Dictionary<string, int>();
            for (int i = 0; i < blueCardCount; ++i)
            {
                var str = Console.ReadLine();
                if (blueCards.ContainsKey(str))
                {
                    // すでに同じ文字列を読み込み格納していたらカウントアップ
                    blueCards[str]++;
                } else
                {
                    // 初めて読み込んだならばカウント１
                    blueCards[str] = 1;
                }
            }

            // 赤いカードを読み込む
            var redCardCount = int.Parse(Console.ReadLine());
            var redCards = new Dictionary<string, int>();
            for (int i = 0; i < redCardCount; ++i)
            {
                var str = Console.ReadLine();
                if (redCards.ContainsKey(str))
                {
                    redCards[str]++;
                } else
                {
                    redCards[str] = 1;
                }
            }

            // いくらもらえるか
            var result = 0;
            var num = 0;
            foreach(KeyValuePair<string, int> item in blueCards)
            {
                if (redCards.ContainsKey(item.Key))
                {
                    // 赤いカードにも同じ文字列があるなら、計算してみる
                    num = item.Value - redCards[item.Key];
                } else
                {
                    // 同じキーがなければ青の枚数分の一円
                    num = item.Value;
                }
                if (result < num)
                {
                    result = num;
                }
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 13152
// atcoder/abc063/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    cout << (set<char>(s.begin(), s.end()).size() == s.size() ? "yes": "no") << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int rdt(void){
  int H;
  int M;
  rd(H);
  rd(M);
  return H*60 + M;
}
int main(){
  int T1;
  int T2;
  int K;
  T1 = rdt();
  T2 = rdt();
  rd(K);
  wt_L(T2-T1-K);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int rdt(void){
//   int H, M;
//   rd(H,M);
//   return H*60 + M;
// }
// 
// {
//   int T1, T2, K;
//   T1 = rdt();
//   T2 = rdt();
//   rd(K);
//   wt(T2-T1-K);
// }


Measured memory_bytes: 3640
/*  .　　∧_∧
   　（ ´・ω・)
   　//＼￣￣旦＼
   ／/ ※ ＼＿＿＿＼
   ＼＼ 　※ 　※ 　※ ヽ
   　 ＼ヽ-＿_＿--＿__ヽ*/
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define vvsort(v) sort(v.begin(),v.end(),greater<int>());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int> > rpq;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
const double PI=acos(-1.0);
//----------------------------------------------------------------------------------------------------------------------------------//
int n,m;
int g[10][10];
int pp[10];
int main(){
        cin>>n>>m;
        while(m--) {
                int x,y;
                cin>>x>>y;
                x--; y--;
                g[x][y]=g[y][x]=1;
        }
        for(int i=0; i<n; i++) {
                pp[i]=i;
        }
        int ans=0;
        do {
                bool flag=true;
                if(pp[0]!=0) continue;
                for(int i=1; i<n; i++) {
                        if(g[pp[i-1]][pp[i]]!=1) {
                                flag=false;
                                break;
                        }
                }
                if(flag) ans++;
        } while(next_permutation(pp,pp+n));
        cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rItr(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define Itr(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define setp(n) fixed << setprecision(n)
#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define All(a) (a.begin()),(a.end())
#define rAll(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll s; cin>>s;
	set<ll> a;
	ll la=s, ans=1;
	a.insert(s);
	while(true){
		ll f;
		ans++;
		if (la%2==1)
			f=3*la+1;
		else
			f=la/2;
		if (a.count(f)) break;
		a.insert(f);
		la=f;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -Wall #-}

import qualified Data.IntSet as S

readInt :: String -> Int
readInt = read

solve :: [Int] -> [Int] -> Int
solve xs ys = S.size $ S.intersection xs' ys'
    where
        xs' = S.fromList xs
        ys' = S.fromList ys

main :: IO ()
main = do
    _  <- getLine
    xs <- fmap (map readInt . words) getLine
    _  <- getLine
    ys <- fmap (map readInt . words) getLine

    let ans = solve xs ys

    print $ ans



Measured memory_bytes: 90812
#include <iostream>
using namespace std;
int sports[1001];
int money,ans,maxvote,n,m,k;
int vote[1001];
int main(){
	cin >> n >> m;
	for(int i=1;i<=n;i++){
		cin >>sports[i];
	}
	for(int i=1;i<=m;i++){
		cin >> money;
		k=1;
		while(money<sports[k]){
			k++;
		}
		vote[k]++;
	}
	ans=1;
	maxvote=0;
	for(int i=1;i<=n;i++){
		if(vote[i]>maxvote){
			maxvote=vote[i];
			ans=i;
		}
	}
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 3088
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>

// Aliases
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using std::cout;
using std::cerr;
using std::cin;
using std::endl;
using std::string;
using std::vector;
using std::array;

template <class T = i64>
vector<T> read_vector(const u64 n)
{
    vector<T> vec;
    vec.reserve(n);
    for (u64 i = 0; i < n; i++)
    {
        T v;
        cin >> v;
        vec.emplace_back(v);
    }

    return vec;
}

int main()
{
    u32 a, b;
    cin >> a >> b;
    if (a > b * 2) { cout << (a - b * 2) << endl; }
    else { cout << 0 << endl; }

    return 0;
}


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

char s[15][15];

char solve(int i,int j){
	if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i][j+1]=='1'&&s[i+1][j+1]=='1'){
		return 'A';
	}
	if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1'){
		return 'B';
	}
	if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1'){
		return 'C';
	}
	if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='1'){
		return 'E';
	}
	if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1'){
		return 'F';
	}
	if(j>0){
		if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i+2][j-1]=='1'){
			return 'D';
		}
		if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i][j+1]=='1'){
			return 'G';
		}
	}
	return 0;
}


int main(){

	
	
	while(!cin.eof()){
		
		for(int i=0;i<15;i++){
			for(int j=0;j<15;j++){
				s[i][j]='0';
			}
		}
		for(int i=0;i<8;i++){
			cin>>s[i];
		}
		char ans;
		bool solved=true;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j]!='1')continue;
				if(solved){
					ans=solve(i,j);
					cout<<ans<<endl;
					solved=false;
				}
			}
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 1132
/* 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
ll n,a[22][22],dp[(1<<22)][22];
ll f(ll mask,ll idx){
	if(__builtin_popcount(mask)==n)return 1;
	if(idx>=n)return 0;
	if(dp[mask][idx]!=-1)return dp[mask][idx];
	ll ans=0;
	for(int j=0;j<22;j++){
		if((((1<<j)&mask)==0)&&a[idx][j]==1)
			ans+=f(mask|(1<<j),idx+1);
		ans%=hell;
	}
	//cout<<ans<<'\n';
	return dp[mask][idx]=ans%hell;
}
int main()
{
	ios
	cin>>n;
	ll i,j;
	memset(dp,-1,sizeof dp);
	for(i=0;i<n;i++){
		for(j=0;j<n;j++)
			cin>>a[i][j];
	}
	cout<<f(0,0);
	return 0;
}

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

	
int main(){
	ios::sync_with_stdio(0); cin.tie(0); 
	
	int n; cin >> n;
	int d = n - n/2;
	double x = d/double(n);
	cout.precision(9);
	cout << fixed;
	cout << x;
      
	
	
	return 0;
}

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

using namespace std;

int main(){
	string x;
	cin >> x;
	int y=0;
	int ans=0;
	for(int unsigned i=0;i<x.size();i++){
		if(x[i] == 'S'){
			y++;
		}else{
			if(y>0){
				y--;
			} else {
				ans+=2;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        int cnt = 0;
        int num = i;
        while(num >= 1) {
            cnt += num % 10;
            num /= 10;
        }
        if(a <= cnt and cnt <= b) ans += i;
    }
    cout << ans << endl;
}

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

int main(){
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int mindist = 100100100;
    for(int i = 0; i < n; i++){
        int dist = 0;
        if(i == 0){
            dist += a[n - 1] - a[0];
        }else if(i > 0){
            dist += a[i - 1];
            dist += k - a[i];
        }
        if(mindist > dist){
            mindist = dist;
        }
    }
    for(int i = 0; i < n; i++){
        int dist = 0;
        if(i == n - 1){
            dist += a[n - 1] - a[0];
        }else{
            dist += a[i];
            dist += k - a[i + 1];
        }
        if(mindist > dist){
            mindist = dist;
        }
    }
    cout << mindist << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;const int N=2*1e5+10;
int w[N];int d[N];int cnt[20];int res;int n;int st;bool book[N];int sxr[N]; 
int main(){
    scanf("%d",&n);
    for(int i=1,u,v,va;i<n;i++){scanf("%d%d%d",&u,&v,&va);w[u]^=va;w[v]^=va;}
    for(int i=0;i<n;i++){cnt[w[i]]++;}
    for(int i=1;i<=15;i++)res+=cnt[i]/2,st|=(cnt[i]&1)<<(i-1);  
    for(int i=1;i<(1<<15);i++)d[i]=d[i>>1]+(i&1);
    for(int i=1;i<(1<<15);i++)d[i]-=1;
    for(int i=1;i<(1<<15);i++)
        for(int j=0;j<15;j++)if((i>>j)&1)sxr[i]^=(j+1);
    for(int i=1;i<(1<<15);i++){
        if(sxr[i]!=0)continue;
        for(int k=(i-1)&i;k;k=(k-1)&i)
            if(sxr[k]==0)d[i]=min(d[i],d[k]+d[i^k]);
    }printf("%d",res+d[st]);return 0;
}

Measured memory_bytes: 768
#include <stdio.h>

int main(void){
    int n, m;
    scanf("%d %d", &n, &m);
    int k[n];
    int like[m];
    for(int i = 0;i < m;i++){
        like[i] = 0;
    }
    for(int i = 0;i < n;i++){
        scanf("%d", &k[i]);
        for(int j = 0;j < k[i];j++){
            int ai;
            scanf("%d", &ai);
            like[ai-1]++;
        }
    }
    int count = 0;
    for(int i = 0;i < m;i++){
        if(like[i] == n)count++;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
S = [0 for i in range(N)]
ans = {
    "AC":0,
    "WA":0,
    "TLE":0,
    "RE":0
}
for i in range(N):
    S[i] = str(input())
    ans[S[i]] += 1

for key in ans.keys():
    print(key + " x " + str(ans[key]))



Measured memory_bytes: 17968
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int main(void) {
	long long int a, b, l, m, n;
	int x[100000], y[100000];
	string s, t;
	char u;
	int i, j, k;
	bool flag = true;
	cin >> n >> m >> l;
	a = n;
	while (a <= l) {
		a += n;
		}
	a -= n;
		if(a >= m)cout << "OK" << endl;
			else cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#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;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


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;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    cout << (a-1)*(b-1);
    cout << endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int h,w;
    char a[100][103] = {{}};
    
    scanf("%d%d", &h, &w);
    for (int i = 0; i < h; i++){
        scanf("%s", &a[i]);
    }
    

    char ans[100][103] = {{}};
    char pre[100][103] = {{}};
    bool hit;
    int ii = 0;
    for (int i = 0; i < h; i++){
        hit = false;
        for (int j = 0; j < w; j++){
            if(a[i][j] == '#') break;
            if(j == w-1) {
                hit = true;
            }
        }
        if(!hit){
            for (int j = 0; j < w; j++){
                pre[ii][j] = a[i][j];
            }
            ii++;
        } 
    }
   /* printf ("\n");
    for (int i = 0; i < ii; i++){
        for (int j = 0; j < w; j++){
            printf ("%c", pre[i][j]);
        }
        printf ("\n");
    }
*/
   
    int jj = 0;
    for (int i = 0; i < w; i++){
        hit = false;
        for (int j = 0; j < ii; j++){
            if(pre[j][i] == '#') break;
            if(j == ii-1) {
                hit = true;
            }
        }
        if(!hit){
            for (int j = 0; j < ii; j++){
                ans[j][jj] = pre[j][i];
            }
            jj++;
        } 
    }
//    printf ("\n");
    for (int i = 0; i < ii; i++){
        for (int j = 0; j < jj; j++){
            printf ("%c", ans[i][j]);
        }
        printf ("\n");
    }

    return 0;

}

Measured memory_bytes: 256
from fractions import gcd
import sys

input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7


def lcm(a, b):
    return a * b // gcd(a, b)


l = A[0]
for a in A:
    l = lcm(l, a)

res = 0
for a in A:
    res = (res + (l * pow(a, MOD - 2, MOD)) % MOD) % MOD
    # res = (res + l // a) % MOD

print(res)


Measured memory_bytes: 6200
from bisect import*
n, *l = map(int, open(0).read().split())
l.sort();c=0
for i in range(n):
  for j in range(i+1, n):
    d = bisect_left(l, l[i] + l[j])
    c += max(0, d-j-1)
print(c)

Measured memory_bytes: 3188
//In the Name of Allah Most Gracious, Most Merciful//
/*If you want something you've never had, you have  to do something you never did.*/

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


#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define M 100007
#define INF 1e9
#define INFL 1e18
#define PI acos(-1)
#define mp make_pair

//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move





int main()
{

   //  #ifndef ONLINE_JUDGE
   //    freopen("input.txt","r",stdin);
   //    freopen("output.txt","w",stdout);
  //   #endif
  int n;
  cin>>n;
  if(n)
  {
      cout<<0<<endl;
  }
  else
  {
      cout<<1<<endl;
  }

}


Measured memory_bytes: 3608
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;


public class Program
{
    public static void Main(string[] args)
    {
        var s = ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var uf = new UnionFindTree(s[0]);
        for (int i = 0; i < s[1]; i++)
        {
            var t = ReadLine().Split(' ').Select(x => int.Parse(x)).Select(x => x - 1).ToArray();
            uf.Unit(t[0], t[1]);
        }
        var ans = uf.solve();
        WriteLine(ans);
        Out.Flush();
    }
}
public static class myRead
{
    public static int readInt() { return int.Parse(ReadLine()); }
    public static long readLong() { return long.Parse(ReadLine()); }
    public static string reatStr() { return ReadLine(); }
    public static int[] readIntArray() { return ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] readLongArray() { return ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] readStrArray() { return ReadLine().Split(' '); }
}


public static class MyMath
{
    public static long Factorical(long n)
    { return n <= 1 ? 1L : n * Factorical(n - 1); }
    public static long Permutation(long n, long m)
    { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
    public static long Combination(long n, long m)
    { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
    public static long Gcd(long n, long m)
    { return n % m == 0 ? m : Gcd(m, n % m); }
    public static long Lcm(long n, long m)
    { return n * m / Gcd(n, m); }
    public static long Pow(long n, long m)
    { return m == 0 ? 1L : m == 1 ? n : n * Pow(n, m - 1); }
}
public class UnionFindTree
{
    private int[] parent;
    private int N; //長さ
    private int[] size; //後ろの数

    public UnionFindTree(int N)
    {
        this.N = N;
        size = new int[N];
        parent = new int[N];
        for (int i = 0; i < N; i++) //初期値　F#の方が宣言が楽でわかりやすい
        {
            size[i] = 1;
            parent[i] = i; //最初は自分自身が親　<-　親はなし
        }

    }


    public int root(int a)
    { return parent[a] == a ? a : root(parent[a]); } //一番上まで見る

    public int[] Size() => this.size;

    public void Unit(int a, int b)
    {
        int ra = root(a);
        int rb = root(b);
        if (ra != rb) //根が同一の時はスルー
        {
            if (ra < rb) //根が小さい方につなげる
            {
                parent[rb] = ra;
                size[ra] += size[rb];
                parent[b] = ra;
            }
            else
            {
                parent[ra] = rb;
                size[rb] += size[ra];
                parent[a] = rb;
            }
        }
    }

    public bool Same(int a, int b)
    {
        return root(a) == root(b);
    }
    public int solve()
    {
        int c = 0;
        for (int i = 1; i < N; i++)
        {
            if (!Same(0, i))
            {
                parent[i] = 0;
                c++;
            }
        }
        return c;
    }
}



Measured memory_bytes: 42160
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		if( Character.isUpperCase( str.charAt( 0 ) ) ) {
		    System.out.println( "A" );
		}
		else {
		    System.out.println( "a" );
		}				
		sc.close();
	}
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  sort(H.begin(),H.end());

  int64_t ans = 0;

  for (int i =0; i < N-K; i++){
    ans += H.at(i);
      }
  

    cout << ans << endl;
  
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(){
        int n = int.Parse(Console.ReadLine());
        int h = int.Parse(Console.ReadLine());
        int w = int.Parse(Console.ReadLine());
        Console.WriteLine((n - h + 1) * (n - w + 1));
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
static const int N=100;
int main(){
  int M[N][N];
  int n,i,j,u,k,v;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++)M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 640
s = gets().chomp().split()
h = s[0].to_i()
w = s[1].to_i()

field = Array.new(h+2)
field[0] = '.' * (w+2)
field[h+1] = '.' * (w+2)
h.times do |i|
  field[i+1] = '.' + gets().chomp() + '.'
end

(h+2).times do |i|
  (w+2).times do |j|
    if field[i][j] == '#' && field[i-1][j] != '#' && field[i+1][j] != '#' && field[i][j-1] != '#' && field[i][j+1] != '#' 
      puts('No')
      exit()
    end
  end
end

puts('Yes')


Measured memory_bytes: 1788
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

set<ll> ancestors, used;

bool dfs(ll v, const vector<vector<ll>>& G) {
  each(to, G[v]) {
    if (ancestors.count(to) > 0) return true;
    if (used.count(to) > 0) continue;
    used.insert(to);
    ancestors.insert(v);
    if (dfs(to, G)) return true;
    ancestors.erase(v);
  }
  return false;
}

bool is_cyclic(const vector<vector<ll>>& G) {
  const ll n = G.size();
  vector<ll> cnt(n, 0);
  rep(i, n) each(to, G[i]) cnt[to]++;
  ll s = -1;
  rep(i, n) {
    if (cnt[i] == 0) {
      s = i;
      if (used.count(i) > 0) continue;
      if (dfs(i, G)) return true;
    }
  }
  rep(i, n) {
    if (used.count(i) > 0) continue;
    if (dfs(i, G)) return true;
  }
  if (s < 0) return true;
  return false;
}

void solve() {
  ll n, m; cin >> n >> m;
  vector<vector<ll>> G(n);
  rep(i, m) {
    ll a, b; cin >> a >> b;
    G[a].pb(b);
  }
  if (is_cyclic(G)) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}



Measured memory_bytes: 3248
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

bool used[200000];

int main(void) {
    int i, n, x;
    scanf("%d%d",&n,&x);
    if (n == 2 && x == 2) {
        puts("Yes");
        REP (i,1,2*n-1) printf("%d\n",i);
    }
    else if (x + 2 <= 2*n-1 && x - 1 >= 1) {
        puts("Yes");
        used[x] = used[x+1] = used[x+2] = used[x-1] = true;
        int j = 1;
        REP (i,n-3) {
            while (used[j]) j++;
            printf("%d\n",j++);
        }
        printf("%d\n",x+2);
        REP (i,3) printf("%d\n",x-1+i);
        REP (i,n-2) {
            while (used[j]) j++;
            printf("%d\n",j++);
        }
    }
    else if (x - 2 >= 1 && x + 1 <= 2*n-1) {
        puts("Yes");
        used[x] = used[x+1] = used[x-2] = used[x-1] = true;
        int j = 1;
        REP (i,n-2) {
            while (used[j]) j++;
            printf("%d\n",j++);
        }
        REP (i,3) printf("%d\n",x-1+i);
        printf("%d\n",x-2);
        REP (i,n-3) {
            while (used[j]) j++;
            printf("%d\n",j++);
        }
    }
    else {
        puts("No");
    }
    return 0;
}


Measured memory_bytes: 1536
import math

N = int(input())
digit_num = math.ceil(math.log10(N))
msd =int(N/(10**(digit_num-1)))

if (N+1)%10 == 0:
    print(msd + 9*(digit_num-1))
elif N-10<0:
    print(N)
else:
    print(msd + 9*(digit_num-1) - 1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    string s;
    int x, y;
    cin >> s >> x >> y;
    s += 'T';

    vec<vec<bool>> xnow(2, vec<bool>(8001, 0)), ynow(2, vec<bool>(8001, 0));
    xnow[0][0] = 1;
    ynow[0][0] = 1;

    bool forx  = true;
    bool first = true;
    int now    = 0;
    for (auto e : s) {
        if (e == 'F') {
            ++now;
        } else {
            if (first) {
                x -= now;
                first = false;
            } else if (now > 0) {
                vec<vec<bool>> &a = (forx ? xnow : ynow);
                rep(i, 8001) {
                    if (!a[0][i]) continue;
                    a[1][abs(i - now)] = true;
                    a[1][abs(i + now)] = true;
                }
                a[0] = a[1];
                a[1] = vec<bool>(8001, 0);
            }
            forx = !forx;
            now  = 0;
        }
    }

    bool ans = (xnow[0][abs(x)] && ynow[0][abs(y)]);
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    bool a[N] = {false};
    bool b[N] = {false};
    int x, y;
    for(int i = 0; i < M; i++){
        cin >> x >> y;
        if(x==1){
            a[y] = true;
        }
        if(y==N){
            b[x] = true;
        }
    }

    for(int i = 0; i<N; i++){
        if(a[i] and b[i]){
            puts("POSSIBLE");
            return 0;
        }
    }

    puts("IMPOSSIBLE");

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int r,c,sumr,sumc=0;
    cin >> r >> c;
    int table[r+1][c+1]={};
    for(int i=0;i<r;i++){
        sumr = 0;
        for(int j=0;j<c;j++){
                cin >> table[i][j];
                sumr+=table[i][j];
                table[r][j]+=table[i][j];
        }
        table[i][c]=sumr;
        sumc+=sumr;
    }
    table[r][c]=sumc;
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c;j++){
            cout << table[i][j] << " ";
        }
        cout << table[i][c] << endl;
    }
    return 0;
}



Measured memory_bytes: 3120
S = input()

flag = True

if S[0] != 'A':
    flag = False

idx = None
for i, s in enumerate(S[2:-1]):
    if s == 'C':
        if idx == None:
            idx = i + 2
        else:
            flag = False

if idx == None:
    flag = False

for i, s in enumerate(S):
    if i == 0 or i == idx:
        continue

    if s != s.lower():
        flag = False

if flag:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int n, i, x;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		for (i = 1; i <= n; ++i) {
			x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
				continue;
			}
			while (x != 0) {
				if (x % 10 == 3) {
					System.out.print(" " + i);
					break;
				}
				x /= 10;
			}
		}
		System.out.print("\n");
		sc.close();

	}

}



Measured memory_bytes: 29000
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int a,b;
    char op;
    while(op!='?'){
        cin>>a>>op>>b;
        if (op=='+')cout<<a+b<<endl;
        if (op=='-')cout<<a-b<<endl;
        if (op=='*')cout<<a*b<<endl;
        if (op=='/')cout<<a/b<<endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int A,B; cin >> A >> B;
  int AB = A*B;
  if(AB % 2 == 0) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;


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


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}



int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	cout << char(s1[0] - 32) << char(s2[0] - 32) << char(s3[0] - 32) << endl;
}


Measured memory_bytes: 256
str = gets.split
A,B,C = str[0].to_i, str[1].to_i, str[2].to_i
if A == B
    if A != C
        puts "Yes"
    else
        puts "No"
    end
else
    if A == C || B == C
        puts "Yes"
    else
        puts "No"
    end
end

Measured memory_bytes: 1788