akhauriyash/Code-Regression huggingface dataset:
// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"
void fo (){fflush(stdout);}
using namespace std;
int dp[100000];
bool vis[100001];
int n , m , M = 1e9 + 7 ;
ll sol (int i )
{
  if (i > n )return 0 ;
  if (vis[i])return 0 ;
  if (i == n )return 1 ;
  int &ret = dp[i];
  if (~ret)return ret ;
  ret = sol (i+1 )%M + sol(i+2)%M ;

  return ret%M ;
}
int main ()
{
  memset(dp , -1 ,sizeof dp );
  scanf ("%d%d" , &n, &m  );
  for (int i =0 , t ; i < m ;i++)scanf ("%d" ,&t ) , vis[t] =1 ;
  printf ("%lld\n" , sol (0) % M );

  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

int dp[1100][2][6];

signed main(){
  string N;
  cin >> N;
  int K;
  cin >> K;

  //i桁目までで0以外をk個使用しており、Nより小さいか、あるいは等しいか
  dp[0][0][0] = 1;

  for( int i = 0; i < N.size(); i++ ){ //i桁目について
    for( int k = 0; k <= K; k++ ){
      //i桁目までで既にNより小さいのでNより下はなんでもok
      dp[i+1][1][k+1] += dp[i][1][k]*9;
      dp[i+1][1][k] += dp[i][1][k];

      int NX = N.at(i)-'0';
      //i桁目まではNと等しく、その下は小さい場合
      if( NX != 0 ) dp[i+1][1][k] += dp[i][0][k];
      for( int n = 1; n < NX; n++ ){
        dp[i+1][1][k+1] += dp[i][0][k];
      }

      //i+1桁目もNと等しい場合
      if( NX == 0 ) dp[i+1][0][k] += dp[i][0][k];
      else dp[i+1][0][k+1] += dp[i][0][k];
    }
  }
  int A = (int)N.size();
  cout << dp[A][0][K] + dp[A][1][K] << endl;

 }


Measured memory_bytes: 256
/*
ID: jerrywcy
LINK: https://atcoder.jp/contests/agc033/tasks/agc033_a
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

const int inf=0x3f3f3f3f;

struct node{
	int x,y,t;
};

int n,m;
bool g[1010][1010];
int sum;
queue<node> q;
int ans;
int dir[4][2]={ 0,-1,
			   -1, 0,
			    0, 1,
				1, 0};

bool ck(int x,int y){
	return (g[x][y] && !(g[x-1][y] && g[x][y-1] && g[x+1][y] && g[x][y+1]));
}

void add(int x,int y,int t){
	for (int i=0;i<4;i++){
		int xx=x+dir[i][0],yy=y+dir[i][1];
		if (!g[xx][yy])g[xx][yy]=1,q.push({xx,yy,t+1});
	}
	return ;
}

int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	sum=n*m;
	
	for (int i=0;i<=n+1;i++)g[i][0]=g[i][m+1]=1;
	for (int i=0;i<=m+1;i++)g[0][i]=g[n+1][i]=1;
	
	for (int i=1;i<=n;i++){
		string str;
		cin>>str;
		for (int j=1;j<=m;j++){
			if (str[j-1]=='#')g[i][j]=1;
		}
	}
	
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			if (ck(i,j))q.push({i,j,0});
		}
	}
	
	while (!q.empty()){
		node tmp=q.front();
		int x=tmp.x,y=tmp.y,t=tmp.t;
		q.pop();
		ans=max(ans,t);
		add(x,y,t);
	}
	
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 7552
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;


int main(){
  int N;
  cin>>N;
  ll A[110000],S[110000],ans=1;
  for(int i=0;i<N;i++){
    cin>>A[i];
    
  }
  sort(A,A+N);

  for(int i=0;i<N;i++){
    if(i==0) S[i]=A[i];
    else S[i]=S[i-1]+A[i];
  }

  for(int i=N-2;i>=0;i--){
    if(S[i]*2>=A[i+1]) ans++;
    else break;
  }
  //cout<<S[1]<<" "<<A[2]<<endl;
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AX solver = new AX();
        solver.solve(1, in, out);
        out.close();
    }

    static class AX {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int a = s.nextInt(), b = s.nextInt();
            w.println(Math.max(a + b, Math.max(a - b, a * b)));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21204
ring = str(input())
request = str(input())
flg = False

for x in range(len(ring)):
    s = ring[x:x+1] 
    t = request[0:1]
    if ring[x:x+1] == request[0:1]:
        cn = 1
        
        if len(request) == 1:
            flg = True
            break

        for y in range(x+1, len(ring)+x+1):
            a = y % len(ring)
            b = ring[a:a+1]
            c = request[cn:cn+1]

            if b != c:
                break
            cn +=1
        if cn == len(request):
            flg = True

if flg == True:
    print('Yes')
else:
    print('No')
        
        




Measured memory_bytes: 5560
import math
import itertools

K = int(input()) + 1
L = list(itertools.combinations_with_replacement(list(range(1, K)), 3))
a = 1
A = 0
for i in L:
  if len(set(i)) == 3:
    a = 6
  elif len(set(i)) == 2:
    a = 3
  else:
    a = 1
  A += math.gcd(math.gcd(i[0], i[1]), i[2]) * a
print(A)

Measured memory_bytes: 105508
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define rrep(i,l,r) for(int i=(r-1);i>=(l);i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define range(i) i.begin(),i.end()
#define sum(i) accumulate(range(i),0)
#define Yes(i) out(i?"Yes":"No")
struct aaa{aaa(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(10);};}aaaaaaa;
inline void in() {}
template <class Head, class... Tail>
inline void in(Head&& head,Tail&&... tail){
    cin>>head;
    in(move(tail)...);
}
template <class T>
inline void out(T t) {
    cout<<t<<'\n';
}
template <class Head, class... Tail>
inline void out(Head head,Tail... tail){
    cout<<head<<' ';
    out(move(tail)...);
}

int main(){
    int a;
    in(a);
    vector<bool> ans;
    while(a){
        ans.push_back(a&1);
        a-=a%2*((a>0)*2-1);//2で余りを0に向かってとる
        a/=-2;//-2で割る
    }
    if(ans.empty()){
        out(0);
        return 0;
    }
    rrep(i,0,ans.size())cout<<ans[i];
}









Measured memory_bytes: 256
import bisect

s,t = input(),input()
n,nx,r = len(s),{},0

for i,c in enumerate(s+s):
	if nx.get(c) is None:
		nx[c] = []
	nx[c].append(i+1)

for c in t:
	l = nx.get(c)
	if l is None:
		print(-1)
		exit()
	r += l[bisect.bisect(l,r%n)]-r%n
print(r)

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

 
int main() {
    int N;
    int flag = 0;
    
    cin >> N; 
    if((N-7) % 10 != 0){
        N /= 10;
        if((N-7) % 10 != 0){
            N /= 10;
            if((N-7) % 10 != 0){
                flag = 1;
            }
        }
    }
    
    if(flag == 0){
  cout << "Yes" << endl;
        
    }
    else{
          cout << "No" << endl;

    }
}

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

typedef long long ll;
ll n;
ll a,b,c,d;
map<ll,ll>mp;
map<ll,ll>vis;
ll min1;

void dfs(ll m,ll cost){
	if(m==1){
		min1=min(min1,cost+d);
		return;
	}
	if(m<(min1-cost)/d){
		min1=m*d+cost;
	}
	if(m%2==0){
		if(mp[m/2]==0||mp[m/2]>cost+a){
			mp[m/2]=cost+a;
			dfs(m/2,cost+a);
		}
	}
	else {
		if(mp[m/2]==0||mp[m/2]>cost+a+d){
			mp[m/2]=cost+a+d;
			dfs(m/2,cost+a+d);
		}
		if(mp[m/2+1]==0||mp[m/2+1]>cost+a+d){
			mp[m/2+1]=cost+a+d;
			dfs(m/2+1,cost+a+d);
		}
	}
	if(m%3==0){
		if(mp[m/3]==0||mp[m/3]>cost+b){
			mp[m/3]=cost+b;
			dfs(m/3,cost+b);
		}
	}
	else {
		if(mp[m/3]==0||mp[m/3]>cost+b+(m%3)*d){
			mp[m/3]=cost+b+(m%3)*d;
			dfs(m/3,cost+b+(m%3)*d);
		}
		if(mp[m/3+1]==0||mp[m/3+1]>cost+b+(3-m%3)*d){
			mp[m/3+1]=cost+b+(3-m%3)*d;
			dfs(m/3+1,cost+b+(3-m%3)*d);
		}
	}
	if(m%5==0){
		if(mp[m/5]==0||mp[m/5]>cost+c){
			mp[m/5]=cost+c;
			dfs(m/5,cost+c);
		}
	}
	else {
		if(mp[m/5]==0||mp[m/5]>cost+c+(m%5)*d){
			mp[m/5]=cost+c+(m%5)*d;
			dfs(m/5,cost+c+(m%5)*d);
		}
		if(mp[m/5+1]==0||mp[m/5+1]>cost+c+(5-m%5)*d){
			mp[m/5+1]=cost+c+(5-m%5)*d;
			dfs(m/5+1,cost+c+(5-m%5)*d);
		}
	}
	return;
}

int main()
{
	ios::sync_with_stdio(false);
	int t;
	cin>>t;
	while(t--){
		cin>>n;
		cin>>a>>b>>c>>d;
		mp.clear();
		vis.clear();
		mp[n]=-1;
		min1=1e18;
		dfs(n,0);
		cout<<min1<<endl;
	}
	return 0;
}

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

const int N = 1100;

char pan[N][N];

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> pan[i];
	for (int i = 0; i < n + n; i++) cout << pan[i / 2] << "\n"; 
	
	return 0;
}


Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    int v[3];
    int cnt=0;
    for(int i=0;i<a.size();i++){
        if(a[i]=='C'){
            cnt=1;
        }
        if(a[i]=='F'&&cnt){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>

using namespace std;

int main()
{
	long long n,k;
	cin >> n >> k;

	long long ans=0;
	for(int b=k+1;b<=n;b++)
	{
		ans+=n/b*(b-k)+(0<n%b-k+1 ? n%b-k+1 : 0)-(k==0 ? 1:0);
	}
	
	cout << ans << endl;




}

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

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


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i, j, n, m, k, ans = 0;
	scanf("%d %d %d", &n, &m, &k);

	for (i = 0; i <= m; i++)
		for (j = 0; j <= n; j++){
			int blk = i * j + (m - i) * (n - j);
			if (blk == k && ans == 0)
				ans = 1;
		}

	if (ans == 1)
		printf("Yes");
	else
		printf("No");

	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int n;
int pile[100001];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &pile[i]);
	}
	sort(pile, pile + n);
	pile[n] = pile[n - 1];

	int x = n, y = 0;
	while (x > 0) {
		int nx = x - 1, ny = y + 1;
		if (pile[nx - 1] <= ny && ny <= pile[nx]) {
			int up = pile[x - 1] - y;
			int left = 0;
			for (int k = x - 1; k >= 0; --k) {
				++left;
				if (k == 0 || (pile[k - 1] <= y && y <= pile[k])) break;
			}
			if (up % 2 == 1 && left % 2 == 1) {
				printf("Second\n");
			}
			else {
				printf("First\n");
			}
			return 0;
		}
		x = nx;
		y = ny;
	}

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i,n,init) for(ll i=init;i<(n);i++)
#define repd(i,n,init) for(ll i=(n);i>=init;i--)
#define repm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define repb(bit,n,init) for(ll bit=init;bit<(1<<n);++bit)

vector<ll> fact, invfact;
ll modpower(ll x, ll n, ll mod){
    ll res = 1;
    while(n){
        if(n&1)res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
ll inv(ll n){
    return modpower(n,MOD-2,MOD);
}
void COMinit(ll k){ //空っぽの配列を二つ
   k++;
   fact.resize(k, 0);
   invfact.resize(k, 0);
   fact[0] = 1;
   repi(i, k, 1)
   {
       fact[i] = fact[i - 1] * i % MOD;
   }
   invfact[k - 1] = inv(fact[k - 1]);
   repd(i, k - 2, 0)
   {
       invfact[i] = invfact[i + 1] * (i + 1) % MOD;
   }
   return;
}
ll nCk(vector<ll> &fact,vector<ll> &invfact,ll n, ll k){ //この関数を使う前にCOMinit
   if (k < 0 || n < k)
       return 0LL;
   return fact[n] * invfact[k] % MOD * invfact[n - k] % MOD;
}
ll com(ll n, ll k)
{
    ll iv = 1;
    ll fa = 1;
    repi(i, k, 0)
    {
        fa *= (n - i);
        fa %= MOD;
    }
    repi(i, k + 1, 1)
    {
        iv *= inv(i);
        iv %= MOD;
    }
    return fa * iv % MOD;
}

//---------main function----------

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll ans = 0;
    repi(i,n,0){
        cin >> a[i];
        ans ^= a[i];
    }
    repi(i,n,0){
        cout << (ans^a[i]) << endl;
    }
   return 0;
}

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    string s;cin >> s;
    if(s == "ABC") puts("ARC");
    else puts("ABC");
    return 0;
}


Measured memory_bytes: 3628
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum[ohara], k, q;
bool f[ohara + 1];

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

  cin >> q;
  rrep(i, 2, ohara) {
    if (!f[i]) {
      for (int j = i + i; j <= ohara; j += i) {
        f[j] = true;
      }
    }
  }
  f[2] = false;
  for (ll i = 3; i < ohara; i += 2) {
    if (!f[i] && !f[(i + 1) / 2]) sum[i]++;
  }
  rrep(i, 1, ohara) sum[i] += sum[i - 1];
  while (q--) {
    cin >> a >> b;
    Cout(sum[b] - sum[a - 1]);
  }
  return 0;
}

Measured memory_bytes: 9472
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        String d = (a+b+c>=22)?"bust":"win";
        System.out.println(d);
    }
}


Measured memory_bytes: 23380
MOD = 10**9+7

n = int(input())
S = input()
ss = [1 if s == "W" else 0 for s in S]

kai = [1 for _ in range(n+1)]
for i in range(1, n+1):
    kai[i] = kai[i-1] * i
    kai[i] %= MOD

def mul(a, b):
    return (a * b) % MOD

ans = 1
num = 0
for s in ss:
    if num % 2 == s:
        num += 1
    else:
        ans *= num
        ans %= MOD
        num -= 1

if num > 0:
    ans = 0

ans *= kai[n]
ans %= MOD

print(ans)


Measured memory_bytes: 9064
N = int(input())

def adjust(a, b, va, vb):
  r = max(a // va, b // vb)
  if va * r < a or vb * r < b:
    r += 1
  
  return va * r, vb * r

t, a = [int(x) for x in input().split()]
for n in range(N - 1):
  ti, ai = [int(x) for x in input().split()]
  t, a = adjust(t, a, ti, ai)

print(t + a)

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

ll powr(ll a,ll b, ll mod)
{
	if(b<=0)
		return 1;
	else if(b%2==0)
	{
		ll x = powr(a,b/2,mod);
		return (x*x)%mod;
	}
	else
		return (a*powr(a,b-1,mod))%mod;
}
void solve()
{
	ll n,mod = 1e9 + 7;
	cin>>n;
	ll a[n];
	ll sum = 0;
	ll sq = 0 ;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		sum = (sum + a[i])%mod;
		sq = (sq + a[i]*a[i])%mod;
	}
	cout<<(((sum*sum)%mod-sq+mod)*powr(2,mod-2,mod))%mod<<endl;

}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 5188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			String s[] = str.split(" ");
			int n = Integer.parseInt(s[0]);
			int k = Integer.parseInt(s[1]);
			String ss = br.readLine();

			String s1 = ss.substring(0, k - 1);
			String s2 = ss.substring(k - 1, k);
			String s3 = ss.substring(k, ss.length());

			System.out.println(s1 + s2.toLowerCase() + s3);

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 22484
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=800+10;
bool map[maxn][maxn],bz[maxn][maxn];
int dl[maxn*maxn][2],f[maxn][maxn],go[4][2];
int i,j,k,l,t,n,m,d,nx,ny,x,y,sx,sy,head,tail,ans;
char ch;
char get(){
	char ch=getchar();
	while (ch!='S'&&ch!='.'&&ch!='#') ch=getchar();
	return ch;
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	fo(i,1,n){
		fo(j,1,m){
			ch=get();
			if (ch=='S'){
				sx=i;
				sy=j;
			}
			else if (ch=='#') map[i][j]=1;
		}
	}
	head=0;tail=1;
	bz[sx][sy]=1;
	dl[1][0]=sx;dl[1][1]=sy;
	go[0][0]=1;go[1][0]=-1;
	go[2][1]=1;go[3][1]=-1;
	while (head<tail){
		head++;
		nx=dl[head][0];ny=dl[head][1];
		if (f[nx][ny]==k) continue;
		fo(i,0,3){
			x=nx+go[i][0];y=ny+go[i][1];
			if (x<1||x>n||y<1||y>m) continue;
			if (bz[x][y]||map[x][y]) continue;
			bz[x][y]=1;
			f[x][y]=f[nx][ny]+1;
			tail++;
			dl[tail][0]=x;dl[tail][1]=y;
		}
	}
	ans=100000000;
	fo(i,1,n)
		fo(j,1,m)
			if (bz[i][j]){
				d=min(i-1,min(j-1,min(n-i,m-j)));
				ans=min(ans,(d%k==0)?d/k:d/k+1);
			}
	ans++;
	printf("%d\n",ans);
}

Measured memory_bytes: 9088
// Crt. 2020-01-14  15:20:17
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#define N 100005
using namespace std;
typedef long long ll;

int n;
ll a[N];
map<ll, ll> rev;
map<ll, int> cnt;

int main() {
#ifdef LOCAL_JUDGE
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    cin >> n;
    for (int k = 1; k <= n; ++k) {
        ll x, now = 1, inow = 1;
        scanf("%lld", &x);
        for (int i = 2; 1ll * i * i * i <= x; ++i) {
            if (x % i) continue;
            int c = 0;
            while (x % i == 0) x /= i, ++c;
            c %= 3;
            if (c == 1) now *= i, inow *= i * i;
            if (c == 2) now *= i * i, inow *= i;
        } if (x > 1) {
            ll tmp = sqrt(x);
            if (tmp * tmp == x) now *= tmp * tmp, inow *= tmp;
            else now *= x, inow *= x * x;
        }
        //cout << k << " " << now << " " << inow << endl;
        a[k] = now; ++cnt[now];
        rev[now] = inow;
    }

    sort(a + 1, a + n + 1);
    n = unique(a + 1, a + n + 1) - (a + 1);

    int ans = (bool) cnt[1];

    ll t;
    for (int i = 1, tmp; i <= n; ++i) {
        if (a[i] == 1) continue;
        if ((tmp = cnt[a[i]]) >= cnt[t = rev[a[i]]])
            ans += tmp, cnt[a[i]] = cnt[t] = 0;
    }

    cout << ans << endl;

    return 0;
}


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

#define DEBUG

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;

const int MOD = 1000000007;
const double PI=acos(-1.0);

// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;

// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)

// メモリ関連
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)

// 最大値と最小値を更新する
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// 素数判定
bool isPrime(int n){if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;double sqrtNum=sqrt(n);for(int i=3;i<=sqrtNum;i+=2)if(n%i==0)return false;return true;}

// ソート
template<class T>vector<T>sortVector(vector<T>v,bool b=true){if(b)sort(v.begin(),v.end());else sort(v.begin(),v.end(),greater<T>());return v;}

// Z-Algorithm O(|S|)
vector<ulint>z_algorithm(string s){vector<ulint>a(s.length());a[0]=s.size();for(ulint i=1,j=0,k;i<s.size();){while(i+j<s.size()&&s[j]==s[i+j])++j;a[i]=j;k=!!j;while(i+k<s.size()&&k+a[k]<j)a[i+k]=a[k],++k;i+=k+!j;j-=k;}return a;}

int solve(int n, int m, vector<int> s, vector<int> c) {
    rep(i, m) {
        rep(j, m) {
            if(i != j && s[i] == s[j] && c[i] != c[j]) return -1;
        }
    }
    rep(i, m) {
        if(s[i] == 1 && c[i] == 0) {
            if(n == 1) return 0;
            else return -1;
        }
    }
    int t[10] = { 0 };
    bool tb[10] = { false };
    rep(j, m) {
        t[s[j] - 1] = c[j];
        tb[s[j] - 1] = true;
    }
    int v[] = { 1, 10, 100 };
    int ans = 0;
    rep(i, n) {
        if(tb[i]) ans += t[i]*v[n-i-1];
    }
    if(tb[0] == false) ans += v[n-1];
    if(n == 1 && tb[0] == false) return 0;
    if(ans < 0) return -1;
    return ans;
}

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int>s(m), c(m);
    
    rep(i, m) {
        cin >> s[i] >> c[i];
    }
    
    cout << solve(n, m, s, c);
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<bitset>
using namespace std;
double abs(double a){
    return (a<0)?-a:a;
}
int main(){
    int q;
    while(cin>>q,q!=-1){
        double x=(double)q/2;
        while(true){
            if(0.00001*q-abs(x*x*x-q)>0)break;
            x=x-(x*x*x-q)/(3*x*x);
        }
        cout<<fixed<<x<<endl;
    }
}

Measured memory_bytes: 1232
x = int(input())
l =[1]

for i in range(2,200):
    if i*i > 1000:
        break
    for j in range(2,100):
        if i**j > 1000:
            break
        l.append(i**j)
l.append(1005)
l.sort()
for i in range(len(l)):
    if l[i]>x:
        print(l[i-1])
        exit(0)

Measured memory_bytes: 3316
import numpy as np
from math import ceil

N, K = tuple(map(int, input().split()))
A = np.array([int(x) for x in input().split()])

I = np.argmin(A)
D = max(1, min(N - I, I) - 1)
C = K - 1
small_part = ceil(D / C)
done = C * small_part + 1

print(small_part + ceil((N - done) / C))

Measured memory_bytes: 23392
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

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

int main(){
    int N,A,B;
    cin >> N >> A >> B;
    if(N*A > B)cout << B << endl;
    else cout << N*A << endl;
}

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

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}
bool sosuu_check(int num) {
	int i;
	for (i = 2; i <= sqrt(num); ++i) {
		if (num%i == 0)
			return false;
	}
	return (num < 2) ? false : true;
}

int main() {
	ll A, B, K,i;
	cin >> A >> B >> K;
	REP(i, K) {
		if (i % 2 == 0) {
			if (A % 2 == 1)
				A -= 1;
			A /= 2;
			B += A;
		}
		else {
			if (B % 2 == 1)
				B -= 1;
			B /= 2;
			A += B;
		}
	}
	cout << A << " " << B << endl;
}


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

int main() {
    int n;
    cin >> n;

    int l[n];
    for (int i = 0; i < n; i++) cin >> l[i];

    sort(l, l + n);

    int a = 0;
    for (int i = 0; i < n - 1; i++) a += l[i];

    cout << (a > l[n - 1] ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long a,b,c,d;
	cin >> a >> b >> c >> d;
	long long p=a*c, q=a*d, r=b*c, s=b*d;
	cout << max(max(max(p,q), r), s);
	return 0;
}

Measured memory_bytes: 3192
x,y = map(int,input().split())
if x%3 == 0 or y%3 == 0:
    print(0)
    exit()
ans = []
ans.append(x)
ans.append(y)
for x,y in (x,y),(y,x):
    a1 = x//3
    a2 = x-a1
    b1 = y//2
    b2 = y-y//2
    ans.append(max(a1*y,a2*b1,a2*b2)-min(a1*y,a2*b1,a2*b2))
    a1 = x//3+1
    a2 = x-a1
    ans.append(max(a1*y,a2*b1,a2*b2)-min(a1*y,a2*b1,a2*b2))
print(min(ans))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long 
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mkp make_pair
  #define pb push_back
  #define inf INT_MAX

  int32_t main()
  { 
   
    
    IOS
    int n,k;
    cin>>n>>k;
    //max-min of k-th size window in the sorted array!

    std::vector<int> v (n,0);
    for(int i=0;i<n;i++)
      cin>>v[i];
    sort(v.begin(),v.end());
    int ans=v[k-1]-v[0];

    for(int i=k;i<n;i++)
    {
      int diff=v[i]-v[i-k+1];
      ans=min(ans,diff);
      
    }
    
    cout<<ans;
    return 0;
   
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <set>
#include <string>
#include <iterator>
#include <queue>
#include <cmath>
#include <cassert>

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

int main ()
{
    ll N; cin >> N;

    set < ll > div;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            div.insert(i);
            div.insert(N / i);
        }
    }

    vector < ll > cnd;
    for (auto x : div) {
        if (x == 1) continue;
        cnd.push_back(x - 1);
    }

    ll ans = 0;
    REP(i,cnd.size()) {
        if (N / cnd[i] == N % cnd[i]) {
            ans += cnd[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m;
    ll k;
    cin>>m>>k;
    if(k>=pow(2,m)){
      cout<<-1<<endl;
      return 0;
    }
    if(m==0){
      cout<<0<<' '<<0<<endl;
      return 0;
    }else if(m==1){
      if(k==0){
        cout<<0<<' '<<0<<' '<<1<<' '<<1<<endl;
        return 0;
      }else{
        cout<<-1<<endl;
        return 0;
      }
    }
    vector<ll> a,b;
    rep(i,pow(2,m)){
      if(i!=k){
        a.push_back(i);
        b.push_back(i);
      }
    }
    reverse(begin(b),end(b));
    rep(i,len(a)) cout<<a[i]<<' ';
    cout<<k<<' ';
    rep(i,len(b)) cout<<b[i]<<' ';
    cout<<k<<endl;
}

Measured memory_bytes: 4076
n=int(input())
a=list(map(int, input().split())) 
b=[]
b.append(sum(a)-sum(a[1:n-1:2])*2)

for i in range(n-1):
    b.append(round(a[i]-b[i]/2)*2)
print(' '.join(map(str, b)))

Measured memory_bytes: 19140
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func gets() string {
	sc.Scan()
	return sc.Text()
}

func toInt(value string) int {
	num, _ := strconv.Atoi(value)
	return num
}

func splitWithInt(value string) []int {
	vals := strings.Split(value, " ")
	nums := make([]int, len(vals))
	for index, elem := range vals {
		nums[index] = toInt(elem)
	}
	return nums
}

func main() {
	nums := splitWithInt(gets())
	fmt.Println(nums[0] - (nums[1] - 1))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

int main() {
  int n;
  cin >> n;

  int x = n * 100 / 108;

  if (x * 108 / 100 == n) {
    cout << x << endl;
  } else if ((x + 1) * 108 / 100 == n) {
    cout << x + 1 << endl;
  } else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int[][] dp;
    static int[] coins;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        coins = new int[m];
        for (int i = 0; i < m; i++) {
            coins[i] = sc.nextInt();
        }
        Arrays.sort(coins);
        dp = new int[m][n + 1];
        System.out.println(dfw(m - 1, n));
    }
    
    static int dfw(int idx, int amount) {
        if (amount == 0) {
            return 0;
        }
        if (idx < 0) {
            return Integer.MAX_VALUE / 10;
        }
        if (dp[idx][amount] != 0) {
            return dp[idx][amount];
        }
        if (amount % coins[idx] == 0) {
            return dp[idx][amount] = amount / coins[idx];
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i * coins[idx] <= amount; i++) {
            min = Math.min(min, dfw(idx - 1, amount - coins[idx] * i) + i);
        }
        return dp[idx][amount] = min;
    }
}


Measured memory_bytes: 31164
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("in", "r", stdin),freopen("out", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int v[N][3];
int n;
int dp[N][2][2][2];
int f(int i, bool a, bool b, bool c){
    if(i == n + 1)
        return 0;
    int &ans = dp[i][a][b][c];
    if(ans != -1)return ans;
    ans = 0;
    if(a == 1){
        ans = max(ans, f(i + 1, 0, 1, 0) + v[i][1]);
        ans = max(ans, f(i + 1, 0, 0, 1) + v[i][2]);
        ans = max(ans, f(i + 1, 0, 0, 0));
    }
    if(b == 1){
        ans = max(ans, f(i + 1, 1, 0, 0) + v[i][0]);
        ans = max(ans, f(i + 1, 0, 0, 1) + v[i][2]);
        ans = max(ans, f(i + 1, 0, 0, 0));
    }
    if(c == 1){
        ans = max(ans, f(i + 1, 1, 0, 0) + v[i][0]);
        ans = max(ans, f(i + 1, 0, 1, 0) + v[i][1]);
        ans = max(ans, f(i + 1, 0, 0, 0));

    }
    return ans;
}
int main(){
    //FL;
    FIN;
    cin >> n;
    fore(i, 1, n + 1)cin >> v[i][0] >> v[i][1] >> v[i][2];
    cls(dp, -1);
    cout << f(0, 1, 0, 0);
    EjecuteTime;
    return 0;
}       

Measured memory_bytes: 19024
package main
/*
A P
*/
import (
        "bufio"
        "fmt"
        // "log"
        "os"
        "strconv"
        "strings"
)

func main() {
        stdin := bufio.NewScanner(os.Stdin)
        stdin.Scan()
        line := strings.Split(stdin.Text(), " ")
        a, _ := strconv.Atoi(line[0])
        p, _ := strconv.Atoi(line[1])
        //_,_=a,p
	pa := a*3 + p
	pienum := (pa - pa%2)/2
	fmt.Println(pienum)
}


Measured memory_bytes: 640
N = int(input())
DG={}  # それぞれのnodeが持つ隣接リストを、キーをnodeにして管理
node_ls=[]
is_visited={}  # 訪れたかどうかを、nodeをキーに辞書で管理


# 有向グラフをディクトで管理することにする
for _ in range(N):
    tmp = input().split()
    node_id = tmp[0]
    node_ls.append(node_id)      # 1~n の順番
    is_visited[node_id] = False  # 訪れた時にTrueにする
    adj_num = int(tmp[1])    # 次数（隣接リストの数）
    if adj_num != 0:
        DG[node_id] = tmp[2:]  # 隣接リストを入れる
    else:
        DG[node_id] = []


d = {} # 発見した時刻を、nodeをキーにして保存する
f = {} # 隣接リストを調べ終えた時刻を、nodeをキーにして保存する
t = 1

def dfs(node):
    global t
    if is_visited[node]:  # 既に訪れていた場合
        return
    is_visited[node] = True
    d[node] = t # 訪れた時刻を入れる
    t += 1
    
    for no in DG[node]:
        dfs(no)
        
    f[node]=t # 隣接リストを全て調べ終えた時刻を入れる
    t += 1
    
for node in node_ls:  # 1~n の順番
    dfs(node)
    
for node in node_ls:
    print(node, d[node], f[node])
    
    




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

int main(){
    int N; cin >> N;
    if(N<10){
        cout << N << endl;
    }else if(N<100){
        cout << 9 << endl;
    }else if(N<1000){
        cout << 9 + (N - 99) << endl;
    }else if(N<10000){
        cout << 909 << endl;
    }else if(N<100000){
        cout << 909 + (N-9999) << endl;
    }else{
        cout << 90909 << endl;
    }
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin - 1; 0 <= end; i--)		// repeat reverse

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif

int main(void)
{
  ll a; cin >> a;
  ll b; cin >> b;
  ll c; cin >> c;
  
  if (a < c && c < b)
    cout << "Yes";
  else if (b < c && c < a)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define ll long long int

using namespace std;


main()
{
	ll n;
	cin>>n;
	ll ans=0;
	ll a[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		if(i%2==0 && a[i]%2==1)
			ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

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

    ll result = N % K;

    result = min(result,abs(result-K));

    cout << result << endl;
}


Measured memory_bytes: 3592
program main
character*3 :: n
integer :: a = 0
read(*,*)n
do i = 1,3
if (n(i:i) == '7') then
a = 1
end if
end do
if (a == 1) then
write(*,*) 'Yes' 
else 
write(*,*) 'No'
end if
end program main

Measured memory_bytes: 2820
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int w,h,x,y;
    cin>>w>>h>>x>>y;
    printf("%lf",double(w)*double(h)/2);
    cout<<" ";
    if (x+x==w&&y+y==h) {
        cout<<1<<endl;
    } else {
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int  a,b,c=0,tmp;
  scanf("%d%d",&a,&b);
  if(3>a){
    return 1;
  }else if(b>20){
    return 1;
  }

  if(a<=b){
    tmp = a;
    a = b;
    b = tmp;
  }

  c = a;
  a =a-1;

  if(a<=b){
    tmp = a;
    a = b;
    b = tmp;
  }

  printf("%d\n",c+a);
  return 0;
}

Measured memory_bytes: 128
(defun setp (list)
  (if (null list)
      t
      (if (member (car list) (cdr list) :test #'equal)
          nil
          (setp (cdr list)))))

(defun main ()
  (let ((s (concatenate 'list (read-line))))
    (if (setp s)
        (format t "yes~%")
        (format t "no~%"))))

(main)


Measured memory_bytes: 5476
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
    double r;
    cin >> r;
    
    double pi =acos (-1);
    cout << fixed << setprecision(6);
    double area = r * r * pi;
    double cir = (r+r)*pi;
    cout << area << " " <<cir << endl;

}



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

long long int gcd(long long int a, long long int b) {
  if(a % b == 0) return b;
  else return gcd(b, a % b);
}

long long int lc(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}

int times(long long int n) {
  int res = 0;
  while(n % 2 == 0) {
    n /= 2;
    res++;
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;

  vector<long long int> a(n);

  for(int i=0;i<n;i++) {
    int j;
    cin >> j;
    a[i] = j / 2;
  }

  long long int lcm = a[0];

  for(int i=1;i<n;i++) {
    if((lcm % 2 == 0 && a[i] % 2 == 1) || (lcm % 2 == 1 && a[i] % 2 == 0)) {
      lcm = 0;
      break;
    } 
    if(times(lcm) != times(a[i])) {
      lcm = 0;
      break;
    }
    lcm = lc(lcm, a[i]);
    if(lcm > m) {
      lcm = 0;
      break;
    }
  }

  int ans = 0;
  if(lcm == 0) ans = 0;
  else if((m/lcm)%2 == 1) ans = (m / lcm) / 2 + 1;
  else ans = (m / lcm) / 2;

  cout << ans << endl; 
}

Measured memory_bytes: 1024
#include <iostream>
#include <complex>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
typedef complex<double> xy_t;

double crossPro(xy_t a, xy_t b)
{
	return (conj(a) * b).imag();
}

int main()
{
	xy_t P[105];
	double x,y;
	//char dummy;
	int N;
	cin >> N;
	/*
	scanf("%lf,%lf", &x, &y);
	xy_t temp(x,y);
	P.push_back(temp);	
	cout << P[0] << endl << endl;
	*/

	for(int i = 0; i < N; ++i)
	{
		cin >> x >> y;
		xy_t temp(x,y);
		P[i] = temp;
	}

	//cout << endl << endl;

	/*for (int i = 0; i < N; ++i)
	{
		cout << P[i] << endl;
	}*/

	//cout << endl;

	double sum = 0;
	for (int i = 0; i < N-2; ++i)
	{
		xy_t a = P[0], b = P[i+1], c = P[i+2];
		//cout << "vector :" << b-a << c-a << endl;
		//cout << "sum :" << crossPro(b-a,c-a) << endl;
		sum += 0.5 * crossPro(b-a,c-a);
	}

	sum = max(sum,-1.0*sum);
	printf("%.1f\n", sum);

	return 0;
}


Measured memory_bytes: 3296
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 1010
using namespace std;
long long a[MAXN],a1[MAXN],n,sum[2],used[MAXN],flag,r[MAXN],l[MAXN];
bool dele[MAXN];
vector<int> ans;
void del(int x){
    ans.push_back(x+1);
    a[x]=0;
    memset(dele,0,sizeof dele);
    memset(used,0,sizeof used);
    if(x!=0){
        dele[x-1]=1;
        a[x]+=a[x-1];
    }
    if(x!=n-1){
        dele[x+1]=1;
        a[x]+=a[x+1];
    }
    for(int i=0;i<n;i++)
        a1[i]=a[i];
    int cnt=0;
    for(int i=0;i<n;i++)
        if(dele[i]==0)
            a[cnt++]=a1[i];
    for(int i=0;i<n;i++)
        if(a[i]>0&&flag==i%2)
            used[i]=1;
    n=cnt;
}
void work(){
    int maxid=0;
    for(int i=0;i<n;i++)
        if(a[i]>a[maxid])
            maxid=i;
    PF("%lld\n%d\n",a[maxid],n-1);
    int sum=n;
    for(int i=0;i<maxid;i++){
        PF("%d\n",1);
        sum--;
    }
    for(int i=n-1;i>maxid;i--){
        PF("%d\n",sum);
        sum--;
    }
}
int main(){
    SF("%d",&n);
    for(int i=0;i<n;i++)
        SF("%lld",&a[i]);
    for(int i=0;i<n;i++)
        if(a[i]>0)
            sum[i%2]+=a[i];
    if(sum[0]==0&&sum[1]==0){
        work();
        return 0;
    }
    if(sum[0]>sum[1])
        flag=0;
    else
        flag=1;
    for(int i=0;i<n;i++){
        l[i]=i-1;
        r[i]=i+1;
    }
    for(int i=0;i<n;i++)
        if(a[i]>0&&flag==i%2)
            used[i]=1;
    while(n>1){
        /*for(int i=0;i<n;i++)
            PF("{%d}",used[i]);
        PF("\n");*/
        for(int i=0;i<n;i++){
            if(i==0||i==n-1){
                if(used[i]==0){
                    if(i==0)
                        flag^=1;
                    del(i);
                    break;
                }
            }
            else if(used[i-1]==used[i+1]){
                del(i);
                break;
            }
        }
    }
    PF("%lld\n%d\n",a[0],ans.size());
    for(int i=0;i<ans.size();i++)
        PF("%d\n",ans[i]);
}


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

int main(){
	int A,B,C;
	
	cin >> A >> B >> C;
	
	if(A != B && A != C){
		cout << A << endl;
	}
	if(B != A && B != C){	
		cout << B << endl;
	}	
	if(C != A && C != B){
		cout << C << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const ll MOD = 1e9+7;
int n;
string s[111111];

int dfs(int i=0,int j=0){
  if('0'<=s[i][j]&&s[i][j]<='9')return s[i][j]-'0';
  int res=(s[i][j]=='+'?0:1);
  for(int k=i+1;k<n;k++){
    if(j+1>=s[k].size())break;
    if(s[k][j+1]=='.')continue;
    if(s[i][j]=='+')res+=dfs(k,j+1);
    if(s[i][j]=='*')res*=dfs(k,j+1);
  }
  return res;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)cin>>s[i];
    cout<<dfs()<<endl;
  }
  return 0;
}



Measured memory_bytes: 4096
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
using namespace std;
int main()
{

	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	string s,t;
	//long long n, A[1000000000];
	long long n, m;
	long long  z[100000];
	cin >> n;
	for ( a = 0; a < n; a++)
	{
		cin >> b;
		c += b;
	}
	//cin >> a;
	//cin >> b;
	//cin >> c;
	//cin >> d;
	//m = 0;
	
	//std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	cout << c - n << endl;

	return 0;
}

Measured memory_bytes: 256