akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>
 
#define f first
#define s second
#define mp make_pair
 
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;
 
typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;
 
int kabe[5][5][5][5];
 
enum direct {
  RIGHT = 0,
  DOWN  = 1,
  LEFT  = 2,
  UP    = 3
};
 
const char *dstr = "RDLU";
 
const int dx[4] = { 1, 0,-1, 0};
const int dy[4] = { 0, 1, 0,-1};
 
#define D(d) (((d)+4)%4)
 
bool go(int x1, int y1, int x2, int y2){
  if(x2 < 0 || y2 < 0 || x2 >= 5 || y2 >= 5) return false;
  return kabe[x1][y1][x2][y2] == 1;
}
 
int main(){
  string str;
  REP(i,9){
    cin>>str;
    if(i%2 == 0){
      REP(j,4){
    int x = j;
    int y = i/2;
    if(str[j] == '1'){
      kabe[x][y][x+1][y] = kabe[x+1][y][x][y] = 1;
    }
      }
    }else{
      REP(j,5){
    int x = j;
    int y = i/2;
    if(str[j] == '1'){
      kabe[x][y][x][y+1] = kabe[x][y+1][x][y] = 1;
    }
      }
    }
  }
  int x = 0, y = 0;
  int d = RIGHT;
  while(x != 0 || y != 0 || d == RIGHT){
    d = D(d-1);
    while(!go(x,y,x+dx[d],y+dy[d])) d = D(d+1);
    putchar(dstr[d]);
    x += dx[d]; y += dy[d];
  }
  puts("");
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define vi vector<int>
#define ppi pair<int,pi>
#define ld long double
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << end
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define f(i, begin, end) for (__typeof(end) i = (begin); i != (end) ; i += 1 - 2 * ((begin) > (end)))
#define nl cout<<"\n";
#define par(a,n) f(i,0,n) cout<<a[i]<<" "; nl
//void prt(int x) {cerr << x;}
#define vv(n,m) vector <vector <int> > v(n, vector <int> (m));

#define er(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... brgs>
void err(istream_iterator<string> it, T a, brgs... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);	
}
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef pair<int,int> pii;
typedef vector<pii> vpii;
const int mod = 1000000007;
const int N = 3e5;

int kadane(int*a, int n);
bool isPrime(int n);
int mpow(int a, int b);


void solve(){
    //cout<<(int)'a'<<(int)'z'<<(int)'A'<<(int)'Z';
    char c;
    cin>>c;
    if((int)c<=122 && (int)c>=97){
      cout<<"a\n";
    }else cout<<"A\n";
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int t;
    // cin>>t;
    // while(t--)
    solve();
        
}

int mpow(int a, int b){ /* pow(a, b) % m */
  int m=mod;
  int x=1;
  while (b>0){
    if (b&1){
      x=(x * a) % m;
    }
    a=(a*a) % m; /* compute the next power of 2 */
    b>>=1; /* this is equivalent to b = floor(b / 2) */
  }
  return x;
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; 
} 

int kadane(int*a, int n){
    int max_so_far = INT_MIN, max_ending_here = 0;
    f(i,0,n){
        max_ending_here+=a[i];
        max_so_far = max(max_so_far, max_ending_here);
        if(max_ending_here<0) max_ending_here=0;
    }
    return max_so_far;
}

Measured memory_bytes: 3608
#include <cassert>
#include <cstddef>
#include <vector>

template <class Monoid> class segment_tree {
public:
  using T = typename Monoid::value_type;

private:
  using size_t = std::size_t;

  Monoid mono;
  std::vector<T> tree;

public:
  segment_tree() = default;
  explicit segment_tree(const size_t n, const Monoid &x = Monoid())
      : mono(x), tree(n * 2, mono.identity()) {}

  size_t size() const noexcept { return tree.size() / 2; }

  T fold(size_t first, size_t last) const {
    assert(first <= last);
    assert(first <= size());
    assert(last <= size());
    first += size();
    last += size();
    T ret_l = mono.identity();
    T ret_r = mono.identity();
    while (first != last) {
      if (first % 2 != 0) {
        ret_l = mono.operate(ret_l, tree[first]);
        first += 1;
      }
      first /= 2;
      if (last % 2 != 0) {
        last -= 1;
        ret_r = mono.operate(tree[last], ret_r);
      }
      last /= 2;
    }
    return mono.operate(ret_l, ret_r);
  }

  template <class F> void update(size_t index, const F &f) {
    assert(index < size());
    index += size();
    tree[index] = f(tree[index]);
    while (index != 1) {
      index /= 2;
      tree[index] = mono.operate(tree[index * 2], tree[index * 2 + 1]);
    }
  }
};

#include <algorithm>
#include <iostream>
#include <numeric>

int main() {
  struct val {
    int min;
    int sum;
  };
  struct starry {
    using value_type = val;
    val operate(const val &l, const val &r) const {
      return {std::min(l.min, l.sum + r.min), l.sum + r.sum};
    }
    val identity() const { return {std::numeric_limits<int>::max() / 2, 0}; }
  };

  int n, q;
  std::cin >> n >> q;

  segment_tree<starry> seg(n + 1);

  for (int i = 0; i < n + 1; i += 1) {
    seg.update(i, [](auto) { return val({0, 0}); });
  }

  for (int i = 0; i < q; i += 1) {
    int c;
    std::cin >> c;
    if (c == 0) {
      int s, t, x;
      std::cin >> s >> t >> x;
      t += 1;
      seg.update(s, [&](val v) {
        v.sum += x;
        return v;
      });
      seg.update(t, [&](val v) {
        v.sum -= x;
        return v;
      });
    } else {
      int s, t;
      std::cin >> s >> t;
      t += 1;
      std::cout << seg.fold(0, s + 1).sum + seg.fold(s + 1, t + 1).min
                << std::endl;
    }
  }
}


Measured memory_bytes: 4356
import java.util.Scanner;

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

        if(n >= 64){
            System.out.println(64);
        }else if(n >= 32){
            System.out.println(32);
        }else if(n >= 16){
            System.out.println(16);
        }else if(n >= 8){
            System.out.println(8);
        }else if(n >= 4){
            System.out.println(4);
        }else if(n == 3 || n == 2){
            System.out.println(2);
        }else if(n == 1){
            System.out.println(1);
        }
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

template<typename T>
void remove(vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)
        cin >> a[i];
    vector<int> b=a;
    sort(b.begin(),b.end());
    rep(i,n){
        if(a[i]!=b[n-1])
            cout << b[n-1] << endl;
        else
            cout << b[n-2] << endl;
    }
    return 0;
}


Measured memory_bytes: 3200
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1193&lang=jp
import sys

while True:
    n = int(input())
    if n == 0:
        sys.exit()
    puzzle = [[] for _ in range(5)]
    # puzzle input
    for i in range(n):
        for j, stone in enumerate(list(map(int, input().split()))):
            puzzle[j].insert(0, stone)
            # puzzle[j].append(stone)
    tmp_score = 10
    ans = 0
    while tmp_score != 0:
        tmp_score = 0
        for i in range(n - 1, -1, -1):
        #for i in range(0, n):
            flg = False
            for left in range(3):
                for right in range(4, 1 + left, -1):
                        tmp_list = []
                        for idx in range(left, right+1):
                            try:
                                tmp_list.append(puzzle[idx][i])
                            except:
                                tmp_list.append(0)
                        if len(set(tmp_list)) == 1 and not (0 in tmp_list):
                            tmp_score += sum(tmp_list)
                            flg = True
                            # puzzle削除
                            for idx in range(left, right+1):
                                try:
                                    puzzle[idx].pop(i)
                                except:
                                    pass
                            break
                if flg:
                    break
        ans += tmp_score

    print(ans)


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)

#define inf5 100002

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

	if ((a + b) % 2)
		cout << "IMPOSSIBLE" << endl;
	else
		cout << (a + b) / 2 << endl;

	return 0;
}


Measured memory_bytes: 256
A,B,H,M = map(int, input().split())
import math
Hrad = H*math.pi*2/12 + M*math.pi*2/(60*12)
Mrad = M*math.pi*2/60
theta = abs(Hrad - Mrad)
print(math.sqrt(A**2 + B**2 -2*A*B*math.cos(theta)))

Measured memory_bytes: 9380
#include<iostream>
#include <iomanip>
using namespace std;
int main(){
    int b,a,d,r;
    double f;
    cin>>a>>b;
    d = a/b;
    r = a%b;
    f = (double)a/(double)b;
    cout<<d<<" "<<r<<" "<<fixed<<setprecision(100)<<f<<endl;
    return 0;
}


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

int main(){
  int c[100000];
  int d[100000];
  d[0]=0;
  int a,b,k;
  cin >> a >> b;
  for(int i=0;i<a;i++){
    cin >> c[i];
    d[i+1] = d[i] + c[i]; 
    if(d[i+1]<=b){
      k=i+2;
    }
  }

  
  cout << k << endl;
}

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

class MyVector{
private :
	int * A;
	int buf_size;
	int sz;
public :
	MyVector(){
		A = new int[64];
		buf_size = 64;
		sz = 0;
	}
	~MyVector(){
		if(A != NULL){
			delete[] A;
		}
	}
	void pushBack(int x){
		if(sz == buf_size){
			int * tmp = new int[buf_size*2];
			for(int i = 0; i < buf_size; i++){
				tmp[i] = A[i];
			}
			delete[] A;
			A = tmp;
			buf_size *= 2;
		}
		A[sz++] = x;
	}
	int randomAccess(int p){
		if(p >= sz){
			return INT_MAX;
		}
		else{
			return A[p];
		}
	}
	void popBack(){
		if(sz > 0){
			sz--;
		}
	}
};

int main(){
	MyVector mv;
	int q,num,xp;
	cin >> q;
	for(int i = 0; i < q; i++){
		cin >> num;
		if(num == 0){
			cin >> xp;
			mv.pushBack(xp);
		}
		else if(num == 1){
			cin >> xp;
			printf("%d\n",mv.randomAccess(xp));
		}
		else if (num == 2){
			mv.popBack();
		}
	}
	return 0;
}



Measured memory_bytes: 3848
n=int(input())
l=list(map(int,input().split()))
x=[]
i=0
flag=0
for i in range(n-1,0,-1):
    if(l[i]<l[i-1]):
        if(l[i-1]-1==l[i]):
            l[i-1]-=1
        else:
            flag=1
if(flag==0):
    print("Yes")
else:
    print("No")
        



Measured memory_bytes: 63984
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

def counting_sort(a)
  k = a.max
  c = Array.new(k+1, 0)
  a.each do |ai|
    c[ai] += 1
  end
  b = []
  c.each.with_index do |ci, idx|
    tmp = ci
    loop do
      break if tmp.zero?
      b << idx
      tmp -= 1
    end
  end
  return b
end

puts counting_sort(a).map(&:to_s).join(' ')


Measured memory_bytes: 172204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(n); ++i)
#define REP(i, d, n) for(long long i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {//言語変えろ言語変えろ言語変えろ言語変えろ言語変えろ

ll a,b;cin>>a>>b;
  ll c[a]; rep(i,a){cin>>c[i];}
          vector<ll>d(a+1); rep(j,a+1){d.at(j)=0;}
  
  ll g=1; ll ka=0; ll kai=0;
  
  if(b<33330000){rep(o,b){g=c[g-1];}}
  else{
  
  rep(k,b){ka++;
           g=c[g-1];
           if(d.at(g-1)==9){break;}
           else{d.at(g-1)=9;}
           }
   
  rep(l,b){ ll aaa=g; g=c[g-1];
           if(d.at(g-1)==8){g=aaa;break;}          
           else{d.at(g-1)=8;}
           kai++;
           }
  

  ll nok=0;
  nok=(b-kai-ka)%kai;
  
  rep(m,nok){g=c[g-1];}
  }
  
  cout<<g<<endl;
  
         
  
}


Measured memory_bytes: 6372
def main():
    N = int(input())
    h = list(map(int, input().split()))
    
    dp = [0]*N
    dp[1] = abs(h[0] - h[1])
    for i in range(2, N):
        dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]))
    print(dp[-1])
    
if __name__  == '__main__':
    main()

Measured memory_bytes: 20444
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
bool seen[8];
vector<vector<bool>> graph;
void dfs(int s,int n,int *ans){
   bool all_seen=true;
   for(int i=0;i<n;i++){
      if(seen[i]==false){
         all_seen=false;
         break;
      }
   }
   if(all_seen){
      *ans=*ans+1;
      return;
   }
   for(int i=0;i<n;i++){
      if(graph[s][i]){
         if(seen[i]==false){
            seen[i]=true;
            dfs(i,n,ans);
            seen[i]=false;
         }
      }
   }
}

int main(void){
   int N,M;
   cin>>N>>M;
   vector<int> a(M),b(M);
   graph.resize(N);
   for(int i=0;i<N;i++){
      graph[i].resize(N);
   }
   for(int i=0;i<M;i++){
      cin>>a[i]>>b[i];
      a[i]--;
      b[i]--;
      graph[a[i]][b[i]]=true;
      graph[b[i]][a[i]]=true;
   }
   for(int i=0;i<N;i++){
      seen[i]=false;
   }
   seen[0]=true;
   int ans=0;
   dfs(0,N,&ans);
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 10;
const int mod = 1e9 + 7;
ll c[2010][2010];
void init(int n) {
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            if (!j) c[i][j] = 1;
            else c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
        }
    }
}
int main() {
    ios::sync_with_stdio(false);
    cout.tie(0), cin.tie(0);
    int s;
    cin >> s;
    init(2005);
    ll ans = 0;
    for (int i = 1; i * 2 <= s - 1; i++) {
        ans = (ans + c[s - 2 * i - 1][i - 1]) % mod;
    }
    cout << ans << endl;
    return 0;
}


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

public class Main {
  private static int solve(int[] abc, int k) {
    int sum = 0;
    int max = 0;
    for (int v : abc) {
      sum += v;
      max = Math.max(max, v);
    }
    return sum - max + (max << k);
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int[] abc = reader.nextInt(3);
    int k = reader.nextInt();
    out.println(solve(abc, k));
  }
  
  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: 20820
#include <iostream>
#include <utility>
#include <vector>
#include <unordered_map>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
//template <typename T> _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

using M = unordered_map<int, int>;

M read(int n) {
	vector<int> v(n);
	M a;
	for (int &i: v)
		i = in();
	for (int i = 0; i < n; i++) {
		int l = 0;
		for (int j = i; j < n; j++)
			a[l += v[j]]++;
	}
	return move(a);
}

int main() {
	for (int n, m; n = in(), m = in(), n || m;) {
		M a = read(n), b = read(m);
		int c = 0;
		for (auto i: a)
			c += b[i.first] * i.second;
		outl(c);
	}
}


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

int main(){
    map<int,int> ig;
    int N,M;
    cin >> N >> M;
    int Lmax=1;
    int Rmin=N;
    for(int i=0;i<M;i++){
        int L,R;
        cin >> L >> R;
        if(Lmax < L){
            Lmax = L;
        }
        if(Rmin > R){
            Rmin = R;
        }
    }
    if(Rmin-Lmax<0)
    {
        cout << 0 << endl;
        return 0;
    }
    cout << Rmin-Lmax + 1<< endl;
}

Measured memory_bytes: 256
k,a,b=map(int,input().split())
if a+1<b:
    if a-1+2>k:
        print(1+k)
    else:
        num1=a-1+2
        num2=b-a
        print(b+((k-num1)//2)*num2+(k-num1)%2)
else:
    print(1+k)


Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int x,y,z;
    cin >> x >> y >> z;
    cout << (x-z)/(y+z) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


	ll x, n;
	cin >> x >> n;
	set<ll>st;
	for (ll i = 0; i < n; i++)
	{
		ll y;
		cin >> y;
		st.insert(y);
	}
	if (!st.count(x))
	{
		cout << x;
	}
	else
	{
		for (ll i = 1; i <= 200; i++)
		{
			ll y = x - i;
			if (!st.count(y))
			{
				cout << y;
				break;
			}
			y = x + i;
			if (!st.count(y))
			{
				cout << y;
				break;
			}

		}
	}

}


Measured memory_bytes: 3500
import java.util.Scanner;
 
class Main {
	public static void main(String[] args) {
	Scanner Cf=new Scanner(System.in);
	String Jigsaw=Cf.next();
	int cutoff=Cf.nextInt();
	int x=0;
	String printer="";
	for(int i=0;i<Jigsaw.length();i++) {
		if(x==0) {
			printer=printer+Jigsaw.charAt(i);
		}
		x++;
		if(x==cutoff) {
			x=0;
		}
	}
	System.out.println(printer);
	
	}
	
}

Measured memory_bytes: 25940
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if ((a*b)>(c*d))
        cout<<(a*b);
    else if ((a*b)<(c*d))
        cout<<(c*d);
    else if ((a*b)==(c*d))
        cout<<(a*b);

return 0;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const int MOD = 1000000007;

int main() {
  ll N, K;
  cin >> N >> K;
  ll res = 0;
  for (int i = 1; i <= N; i++) {
    ll out = 1;
    ll tmp = i;
    ll cnt = 0;
    while (tmp < K) {
      tmp *= 2;
      cnt++;
    }
    for (int i = 0; i < cnt; i++) {
      out *= 0.5;
    }
    res += out/N;
  }
  cout << fixed << setprecision(11) << res << endl;
  return 0;
}

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

int main(){
	int h,w;
	cin >> h >> w;
	vector<vector<int>> v(h,vector<int>(w,0));
	for(int i=0;i<h;i++){
		string s;
		cin >> s;
		for(int j=0;j<w;j++){
			if (s[j]=='#') v[i][j]=-1;
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if (v[i][j]==-1) {
				for(int dx=-1;dx<=1;dx++)
					for(int dy=-1; dy<=1;dy++){
						if(!(dx==dy && dy==0)){
							int y=j+dy, x=i+dx;
							//cout << x << " " << y << endl;
							if(x>=0 && x < h && y>=0 && y<w && v[x][y]!=-1)
								v[x][y]++;
							}
						}
				}
		}
	}	
	for(auto x:v){
		for(int y:x){
			y==-1 ? cout << '#' : cout << y;
		}
		cout << endl;
	}
				
	
			
     
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
    int n,k;cin>>n>>k;
  ll res = k*pow(k-1,n-1);
    cout<<res;
}



Measured memory_bytes: 256
x, y = map(int, input().split())
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]
A = x in list1 and y in list1
B = x in list2 and y in list2
C = x in list3 and y in list3
if A == True or B == True or C == True:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;

int main(){
  long W, H, x, y;
  cin >> W >> H >> x >> y;
  string res;
  if(x == double(W)/2.0 && y == double(H)/2.0){
    res = '1';
  }else{
    res = '0';
  }
  cout << (long double)(W*H)/2.0 << " " << res << endl;
  return 0;
}


Measured memory_bytes: 256
prev = false

while true
  n = gets.chomp.to_i
  break if n == 0

  teams = []

  for i in (0...n)
    name, cw, cl, cd = gets.chomp.split(" ")

    pt = cw.to_i * 3 + cd.to_i

    teams.push([pt, i, name])
  end

  teams.sort! do |a, b|
    cmppt = b[0] <=> a[0]
    (cmppt != 0) ? cmppt : a[1] <=> b[1]
  end

  puts if prev
  prev = true

  for t in teams
    puts [t[2], t[0]].join(",")
  end
end

Measured memory_bytes: 6120
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def onem():
	return int(input())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

n,v = m()

a = l()
b = l()
c = l()
d = l()

ab = cl.Counter(aa+bb for aa in a for bb in b)
cd = cl.Counter(cc+dd for cc in c for dd in d)

print(sum(g*cd[v-f] for f,g in ab.items() if v-f in cd))




Measured memory_bytes: 203968
time=[];timeloss=[];ans=0
for i in range(5):
    a=input()
    if int(a[-1])==0:
        ans+=int(a)
    else:
        time.append(int(a))
        timeloss.append(10-int(a[-1]))
while len(time)>0:
        for i in range(len(time)):
            if timeloss[i]==min(timeloss):
                ans+=time[i]
                if not len(time)==1:
                    ans+=timeloss[i]
                del time[i];del timeloss[i];break
print(ans)

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    string s;cin>>s;
    int min=100000;

    rep(i,s.size()-2){
        string t=s.substr(i,3);
        int tt=stoi(t);
        if(abs(753-tt)<min){
            min=abs(753-tt);
        }
    }
    cout<<min<<endl;
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define int long long

typedef pair<int,int> pii;
const int N = 1e4+5;
const int M = 1e6+4;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, a[N];
int mu[M];
int mypow(int a, int b){
	int res = 1;
	while(b){
		if (b&1) res = (res*a) % MOD;
		b /= 2;
		a = (a*a) % MOD;
	}
	return res;
}
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	int lcm = 1;
	for(int i=0; i<n; i++){
		int x = a[i];
		for(int j=2; j*j<=x; j++){
			int cnt = 0;
			while(x % j == 0) {
				cnt++;
				x /= j;
			}
			mu[j] = max(mu[j], cnt);
		}
		if (x > 1) mu[x] = max(mu[x], 1LL);
	}
	for(int i=2; i<M; i++) lcm = lcm*mypow(i, mu[i]) % MOD;
	int ans = 0;
	for(int i=0; i<n; i++){
		ans = (ans + lcm*mypow(a[i], MOD-2) % MOD) % MOD;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6656
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

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

const int kMaxK = 100000;

int K;
int A[kMaxK];
long long int L[kMaxK+1], R[kMaxK+1];

long long int Ceil(long long int a, int b) {
  if (a%b == 0) {
    return a/b;
  } else {
    return a/b + 1;
  }
}

int main() {
  cin >> K;
  REP(i, K) { cin >> A[i]; }

  L[K] = 2;
  R[K] = 2;
  RFOR(i, K, 0) {
    long long int min_multiple_of_A = Ceil(L[i], A[i-1]) * A[i-1];
    if (!(L[i] <= min_multiple_of_A && min_multiple_of_A <= R[i])) {
      L[0] = -1;
      break;
    }

    L[i-1] = min_multiple_of_A;
    R[i-1] = (R[i]/A[i-1]) * A[i-1] + A[i-1] - 1;
  }

  if (L[0] == -1) {
    cout << -1 << endl;
  } else {
    cout << L[0] << " " << R[0] << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,M,C; cin>>N>>M>>C;
    vector<int> B(M);
    for(int i=0;i<M;i++){
        cin>>B[i];
    }
    int count=0;
    vector<vector<int>> A(N,vector<int>(M));
    for(int i=0;i<N;i++){
        int ans=0;
        for(int j=0;j<M;j++){
            cin>>A[i][j];
            ans=ans+B[j]*A[i][j];
        }
        ans=ans+C;
        if(ans>0){
            count++;
        }
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
#define rreps(i, s, n) for (int i = n - 1; (int)(s) <= i; --i)
// reps(s,n)[::-1]
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1LL << 60;
class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* _sep, const char* _term) : sep(_sep), term(_term) {}
        template <class... Args> void operator()(const Args&... args) const { print(args...); }
        template <typename T> void pvec(const T& vec, size_t sz) const {
            for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T> void pmat(const T& mat, size_t h, size_t w) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++) std::cout << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail> void print(const T& head, const Tail&... tail) const {
            std::cout << head, print_rest(tail...);
        }
        template <class T, class... Tail> void print_rest(const T& head, const Tail&... tail) const {
            std::cout << sep << head, print_rest(tail...);
        }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints print;

void solve() {
    int n, m;
    cin >> n >> m;
    V<int> K(m);
    VV<int> S(m);
    rep(i, m) {
        cin >> K[i];
        S[i].resize(K[i]);
        rep(j, K[i]) {
            cin >> S[i][j];
            S[i][j]--;
        }
    }
    V<int> P(m);
    rep(i, m) cin >> P[i];

    int ans = 0;
    rep(bit, 1 << n) {
        bool all_light = true;
        rep(i, m) {
            int cur_on = 0;
            for (auto&& j : S[i]) {
                if (bit & (1 << j)) cur_on++;
            }
            if (cur_on % 2 != P[i] % 2) all_light = false;
        }
        if (all_light) ans++;
    }
    print()(ans);
}
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

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

int main()
{
    int n, k, x, y, sum=0;
    cin >> n >> k >> x >> y;
    
    for(int i=0; i<n; i++){
        if(i<k)
            sum+=x;
        else
            sum+=y;
    }cout << sum;
}


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

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;
typedef pair<long long, long long> l4;
typedef vector<long long> vll;
typedef double db;
typedef vector<double> vdb;
typedef pair<double, double> dd;
typedef set<int> si;
typedef set<long long> sll;
#define fi first
#define se second
#define matrix(a) vector< vector<a> >
#define sz(a) int((a).size()) 
#define lop(i,a,b) for (int i=a; i<=b; i++)
#define vlop(i,v) lop(i,0,sz(v)-1)
#define vlop1(i,v) lop(i,1,sz(v)-1)
#define rlop(i,a,b) for (int i=b; i>=a; i--)
#define vrlop(i,v) rlop(i,0,sz(v)-1)
#define vrlop1(i,v) rlop(i,1,sz(v)-1)
#define printv(i,v) vlop(i,v)cout<<v[i]<<" "
#define printv1(i,v) vlop1(i,v)cout<<v[i]<<" "
#define all(s) (s).begin(),(s).end()
#define pb push_back
#define enter cout<<'\n'
#define lb(i,v) int(lower_bound(all(v),i)-v.begin())
#define ub(i,v) int(upper_bound(all(v),i)-v.begin())

int main() {
	int n;
	cin>>n;
	vll a(n);
	ll total=0;
	vlop(i,a){
		cin>>a[i];
		total+=a[i];
	}
	ll ans=abs(total-a[0]*2),presum=a[0];
	lop(i,1,n-2){
		presum+=a[i];
		ans=min(abs(total-presum*2),ans);
		if(!ans)break;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <queue>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define lb(a) lower_bound(a)
#define is(a) insert(a)
#define ps(a) push(a)
const int N=5e5+10;
const int inf=0x3f3f3f3f;
int in[N],loc[N],p[N],ans[N],tot,n,k;
std::priority_queue <int,std::vector<int>,std::greater<int> > q;
int head[N],to[N<<1],Next[N<<1],cnt;
void add(int u,int v)
{
    to[++cnt]=v,Next[cnt]=head[u],head[u]=cnt;
}
#define ls id<<1
#define rs id<<1|1
int min(int x,int y){return x<y?x:y;}
int max(int x,int y){return x>y?x:y;}
int mi[N<<2];
void change(int id,int l,int r,int p,int d)
{
    if(l==r) {mi[id]=d;return;}
    int mid=l+r>>1;
    if(p<=mid) change(ls,l,mid,p,d);
    else change(rs,mid+1,r,p,d);
    mi[id]=min(mi[ls],mi[rs]);
}
int query(int id,int L,int R,int l,int r)
{
    if(mi[id]==inf) return inf;
    if(l==L&&r==R) return mi[id];
    int Mid=L+R>>1;
    if(r<=Mid) return query(ls,L,Mid,l,r);
    else if(l>Mid) return query(rs,Mid+1,R,l,r);
    else return min(query(ls,L,Mid,l,Mid),query(rs,Mid+1,R,Mid+1,r));
}
int main()
{
    scanf("%d%d",&n,&k);
    rep(i,1,n) scanf("%d",p),p[p[0]]=i;
    memset(mi,0x3f,sizeof(mi));
    dep(i,n,1)
    {
        int loc=query(1,1,n,p[i],min(n,p[i]+k-1));
        if(loc!=inf) add(p[i],p[loc]),++in[p[loc]];
        loc=query(1,1,n,max(1,p[i]-k+1),p[i]);
        if(loc!=inf) add(p[i],p[loc]),++in[p[loc]];
        change(1,1,n,p[i],i);
    }
    rep(i,1,n) if(!in[i]) q.ps(i);
    while(!q.empty())
    {
        int now=q.top();
        ans[now]=++tot;
        q.pop();
        for(int i=head[now];i;i=Next[i])
        {
            int v=to[i];
            --in[v];
            if(!in[v]) q.ps(v);
        }
    }
    rep(i,1,n) printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 29684
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.LongStream;
import java.util.stream.Stream;

public class Main {
    long k;
    int n;
    long[] as;
    long[] bs;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    private void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        k = sc.nextLong();
        as = new long[n];
        bs = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
            bs[i] = sc.nextLong();
        }
    }

    private void solve() {
        long ans = 0L;
        int length = Long.bitCount(k);
        for (int i = 0; i < n; i++) {
            if ((as[i] & k) == as[i])
                ans += bs[i];
        }
        for (int i = 0; i <= 30; i++) {
            long bit = 1 << i;
            if ((k &  bit) != 0) {
                final long key = (bit ^ k) | (bit - 1);
                long tmp = 0L;
                for (int j = 0; j < n; j++) {
                    if (as[j] == (as[j] & key) || as[j] == (as[j] & (bit ^ k)))
                        tmp += bs[j];
                }
                ans = Math.max(tmp, ans);
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 95484
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;


public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int K = sc.nextInt();
		if(K%2==1){
			int L = (K+1)/2;
			out.println(L*(L-1));
		}else{
			int L = K/2;
			out.println(L*L);
		}
		out.flush();
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

typedef long long LL;

const int N = 1e6 + 100;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    map<vector<int>, int> M;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        LL x = 0;
        bool dot = false;
        int cnt = 0;
        for(char ch : s) {
            if(ch == '.') {
                dot = true;
                continue;
            }
            if(dot) ++cnt;
            x = x * 10 + ch - '0';
        }
        int five = 0;
        while(x % 5 == 0) {
            five++;
            x /= 5;
        }
        int two = 0;
        while(x % 2 == 0) {
            two++;
            x /= 2;
        }
        vector<int> v = {cnt, two, five};
        M[v]++;
    }
    vector<vector<int>> v;
    for(auto itr : M) {
        vector<int> tt = itr.first;
        tt.push_back(itr.second);
        v.push_back(tt);
    }
    LL ans = 0;
    for(int i = 0; i < v.size(); i++) {
        int c = v[i].back();
        if(2*min(v[i][1],v[i][2]) >= 2*v[i][0]) ans += 1ll * c * (c-1) / 2;
        for(int j = i+1; j < v.size(); j++) {
            if(min(v[i][1]+v[j][1], v[i][2]+v[j][2]) >= v[i][0] + v[j][0]) {
                ans += 1ll * v[i].back() * v[j].back();
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main(){
	int x;
	int y;

	cin >> x >> y;

	if (x > y){
		int tmp = y;
		y = x;
		x = tmp;
	}

//これ以降 x <= y である。

	do{
		int tmp = y % x;
		if (tmp == 0)
			break;
		y = x;
		x = tmp;
	}while(y % x != 0);

	cout << x << "\n";
}


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



int main(){
    int K;
    cin >> K;
    int X;
    cin >> X;
    if(500*K>=X)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

return 0;


}  



Measured memory_bytes: 256
#include<stdio.h>

int main() {
	long long a, b, x, r, tmp;
	scanf("%ld %ld", &a, &b);
	x = a * b;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	printf("%ld", x / b);

	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))
#define INF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

int main()
{
    int N;
    long long int A = 1;
    long long int num;
    int flag = 0;
    int flag2 = 0;

    scanf("%d", &N);

    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &num);
        A *= num;
        if (A > 1000000000000000000 || (A>1000000000 && num > 1000000000))
        {
            flag = 1;
            A = 0;
        }

        if (num == 0)
        {
            printf("0");
            return 0;
        }
    }

    if (flag == 1)
        printf("-1");
    else
        printf("%lld", A);

    return 0;
}

Measured memory_bytes: 3768
import javax.swing.plaf.IconUIResource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.IllegalCharsetNameException;
import java.util.*;
public class Main {
    static long dp[]= new long[2006];
    static long mod=(long) (1e9+7);
    static long mod(long x){
        return ((x%mod+mod)%mod);
    }
    static long add(long a,long b){
        return mod(mod(a)+mod(b));
    }



     public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
         FastScanner sc = new FastScanner();
         PrintWriter out = new PrintWriter(System.out);

             int n = sc.nextInt();
            long a[][]= new long[4][n];
            for (int i=0;i<n;i++){
                long x=sc.nextLong();
                long y=sc.nextLong();
                a[0][i]=x+y;
                a[1][i]=x-y;
                a[2][i]=-x+y;
                a[3][i]=-x-y;
            }
            for (int i=0;i<4;i++){
                Arrays.sort(a[i]);
            }
            long max=Long.MIN_VALUE;
            for (int i=0;i<4;i++){
                max=Long.max(max,a[i][n-1]-a[i][0]);
            }
         System.out.println(max);
         }









    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }
    static void sortReverse(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
//        Collections.sort.(l);
        Collections.sort(l,Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long[] readArrayLong(long n) {
            long[] a=new long[(int)n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}

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

int main() {

 int N;
  long ans;
     long mm,MM;
  cin >>N;
  vector<long> A(N);
    vector<long> B(N);
  for(int i=0;i<N;i++){
    cin >> A[i]>>B[i];
  }
  
      sort(A.begin() , A.end());
    sort(B.begin() , B.end());
    reverse(B.begin() , B.end());

  if(N%2==1){ //odd
    int xx=(N+1)/2;
    mm=A[xx-1];
    MM=B[xx-1];
    ans=MM-mm+1;
    cout <<ans<<endl;
  }//odd
  
  if(N%2==0){ //even
    long smallm;
    long smallM;
    long largem;
    long largeM;
    int yy=N/2;
    int zz=(N+2)/2;
    smallm=A[yy-1];
    smallM=B[zz-1];
    largem=A[zz-1];
    largeM=B[yy-1];
    mm=smallm+largem;
    MM=smallM+largeM;
    ans=MM-mm+1;
    cout <<ans << endl;
    
    
    
  }//even
    
 return 0;
}


Measured memory_bytes: 6428
#include <iostream>
#include <vector>
#include <deque>

using namespace std;
using int64 = long long;

int main() {
    int n;
    cin >> n;
    vector<int64> a(3*n);
    for (int i=0; i<3*n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    deque<int64> deq;
    for (auto ai : a) deq.push_back(ai);

    int64 ans = 0;
    while(!deq.empty()) {
        int64 sum = 0;
        int64 _max = -1;
        int64 _min = INT_MAX;
        sum += deq.back();
        _max = max(_max, deq.back());
        _min = min(_min, deq.back());
        deq.pop_back();
        sum += deq.back();
        _max = max(_max, deq.back());
        _min = min(_min, deq.back());
        deq.pop_back();
        sum += deq.front();
        _max = max(_max, deq.front());
        _min = min(_min, deq.front());
        deq.pop_front();
        ans += sum - _max - _min;
    }

    cout << ans << endl;
}


Measured memory_bytes: 4992
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


def solve():
    L = int(input())
    a = L / 3.0
    print(a ** 3)


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 10140