akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
const ll mod = 1e9+7;
const ll mod1 = 998244353;
#define rep(i,a,b) for(ll i=a;i<b;i++)

void swap(ll &a , ll &b){
    ll t = a;
    a = b;
    b = t;
}

ll min(ll a, ll b){
    if(a<b)return a;
    return b;
}

ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

 ll pow(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return ans;
 }

bool sorter(ll a, ll b){
    if(a>b)return 1;
    return 0;
}


bool check(string &s){

     ll st = 0 ,e  = s.size()-1;
     while(st < e){
        if(s[st] != s[e])return false;
        st++;
        e--;
     }
    return true;
}

int main(){


   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   string s;
   cin>>s;
ll f = s.size()-1;
f /= 2;
f--;
ll second = s.size()+3;
second/=2;
second--;
string t,p;
for(int i = 0 ; i<=f;i++){
    t += s[i];
}
ll n = s.size();
for(int j = second ; j <n;j++){
    p += s[j];
}
if(check(s) && check(t) && check(p))
    cout<<"Yes";
else
    cout<<"No";


}


Measured memory_bytes: 256
@A=glob<>;
@l=<>;
printf sort{$a-$b}map{
	@v=//;
	$x=-30;
	for(0..$#l){
		if($t=$'>>2*$_&3){
			$v[$t]+=$l[$_];
			$x+=10
		}
	}
	for(1..3){
		$x+=abs$A[$_]-($v[$_]||1e9)
	}
	$x
}1..1<<2*@l


Measured memory_bytes: 9472
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll gcd(ll a,ll b){
  if (a%b==0) return(b);
  else return(gcd(b,a%b));
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}
ll cal(ll n,ll a,ll b){
  return n-n/a-n/b+n/lcm(a,b);
}

int main(){
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  if(C==1 or D==1){
    cout << "0" << endl;
    return 0;
  }
  ll ans=cal(B,C,D)-cal(A-1,C,D);
  cout << ans << endl;
  return 0;
}


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

typedef long long lli;

string s;
lli x, p;

namespace NS1 {
  lli exp();
  lli term();
  lli fact();

  lli exp() {
    lli x = term();
    while(s[p] == '+') {
      ++p;
      x += term();
    }
    return x;
  }

  lli term() {
    lli x = fact();
    while(s[p] == '*') {
      ++p;
      x *= fact();
    }
    return x;
  }

  lli fact() {
    return s[p++] - '0';
  }
}

namespace NS2 {
  lli exp();
  lli fact();

  lli exp() {
    lli x = fact();
    while(s[p] == '+' || s[p] == '*') {
      if(s[p] == '+') {
        ++p;
        x += fact();
      } else {
        ++p;
        x *= fact();
      }
    }
    return x;
  }

  lli fact() {
    return s[p++] - '0';
  }
}

int main() {
  cin >> s;
  cin >> x;
  s += "$";
  p = 0;
  lli A = NS1::exp();
  p = 0;
  lli B = NS2::exp();
  if(A == x && B == x)
    cout << "U" << endl;
  else if(A == x && B != x)
    cout << "M" << endl;
  else if(A != x && B == x)
    cout << "L" << endl;
  else
    cout << "I" << endl;
  return 0;
}

Measured memory_bytes: 1204
/*********** Template Starts Here ***********/

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

#define MAX 500
#define ll long long
#define ull unsigned long long
#define ___   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define f(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = b; i >= a; i--)
#define debug(x) cout << #x << " " << x << endl;
#define in(x) cin>>x;
#define out(x) cout<<x;
#define gap cout<<" ";
#define nl cout<<endl;
#define cs(x) cout<<"Case "<<x<<": ";


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

int main()
{
    int k,temp;
    ll sum=0;
    cin>>k;
    for(ll i=1; i<=k; i++)
    {
        for(ll j=1; j<=k; j++)
        {
            for(ll l=1; l<=k; l++)
            {
                temp = gcd(i,j);
                temp = gcd(temp,l);
                sum+=temp;
            }
        }
    }
    cout<<sum;
return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> v;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }

  int cnt = 0;
  rep(i,N){
    if(v[i] == cnt+1){
      cnt++;
    }
  }

  if(cnt == 0) cout << -1 << endl;
  else cout << N - cnt << endl;
  
  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long h,w,n;
    cin >> h >> w >> n;
    int a[n],b[n];
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    long long ans[10];
    fill(ans,ans+10,0);
    ans[0] = (h-2)*(w-2);
    map<pair<int,int>,int> m;
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){
                int p,q;
                p = a[i]+j-2;
                q = b[i]+k-2;
                if(p>=0 && q>=0 && p+2<h && q+2<w){
                    int r = 0;
                    auto it = m.find(make_pair(p,q));
                    if(it != m.end()){
                        r = it->second;
                        it->second++;
                    }
                    else{
                        m.insert(make_pair(make_pair(p,q),1));
                    }
                    ans[r]--;
                    ans[r+1]++;
                }
            }
        }
    }
    for(int i=0; i<10; i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 57216
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;

#define ull unsigned long long
#define ll long long
#define PI 3.141592654

int main(){
	string line;
	map<string,int> type;
	while(getline(cin,line)){
		int index = line.find(",");
		type[line.substr(index+1)]++;
	}	
	cout<<type["A"]<<endl;
	cout<<type["B"]<<endl;
	cout<<type["AB"]<<endl;
	cout<<type["O"]<<endl;
	return 0;
}

Measured memory_bytes: 1188
n = int(input())

sn = []
for i in range(n):
  sn.append(input())

d = {"AC":0,"WA":0,"TLE":0,"RE":0}  
for s in sn:
  if s in d:
    d[s] += 1
    
for di in d.items():
  print(di[0],"x",di[1] )

Measured memory_bytes: 16324
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int gcd3(int a, int b, int c) {
    int ab = __gcd(a, b);
    return __gcd(ab, c);
}
int main() {
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++)
            for(int k = 1; k <= n; k++)
                ans += gcd3(i, j, k);
    }
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 3596
import java.util.Scanner;

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

		int n = sc.nextInt();
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();

		int ans = 0;
		for (int i = 0; i < n; i++) {
			char charA = a.charAt(i);
			char charB = b.charAt(i);
			char charC = c.charAt(i);

			if (charA != charB) {
				if (charB != charC)
					if (charC != charA)
						ans += 2;
					else
						ans++;
				else
					ans++;
			} else {
				if (charB != charC)
					ans++;
			}
		}

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 21716
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
long long a[305][305],l[100050],r[100050],c[100050],e[100050],SUM[100050];
int main(){
	long long h,w,d,q,sum;
	scanf("%lld%lld%lld",&h,&w,&d);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			scanf("%lld",&a[i][j]);
			c[a[i][j]]=i;
			e[a[i][j]]=j;
		}
	}
	c[0]=c[1];
	e[0]=e[1];
	SUM[0]=0;
	for(int i=1;i<=h*w;i++){
		SUM[i]=SUM[i-1]+abs(c[i]-c[i-1])+abs(e[i]-e[i-1]);
	}
	scanf("%lld",&q);
	for(int i=1;i<=q;i++){
		scanf("%lld%lld",&l[i],&r[i]);
		sum=0;
		if(d==1) printf("%lld\n",SUM[r[i]]-SUM[l[i]]);
		else{
			for(int j=l[i]+d;j<=r[i];j+=d){
				sum+=abs(c[j]-c[j-d])+abs(e[j]-e[j-d]);
			}
			printf("%lld\n",sum);
		}
	}
}

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

typedef long long ll;

const int N = 2e5 + 10;

int n, a[N];
ll sum, sum2, ans[N];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) {
		scanf("%d", a + i); sum += a[i];
		if(i % 2 == 0) {
			sum2 += a[i];
		}
	}
	sum /= 2;
	ans[1] = sum - sum2;
	for(int i = 1; i < n; i ++) {
		ans[i + 1] = a[i] - ans[i];
	}
	for(int i = 1; i <= n; i ++) {
		printf("%lld ", ans[i] * 2);
	}
	return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <stack>
#include <unordered_map>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <functional>
#include <iterator>
#include <tuple>

using namespace std;

int main() {
  int n;
  cin >> n;
  int result = 0;

  int result2 = 0;
  int old_h = 0;
  int h;
  for (int i = 0;i < n; i++) {
    cin >> h;
    if (old_h >= h) {
      result2++;
    } else {
      result2=0;
    }
    old_h = h;
    result = max(result, result2);
  }
  
  cout << result <<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N,A,cnt=1<<30;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A;
    int c=0;
    while(!(A%2)){A/=2;c++;}
    cnt=min(cnt,c);
  }
  cout << cnt; 
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = (tail+1)%LEN;
}

P dequeue(){
  P a;
  a = Q[head];
  head = (head+1)%LEN;
  return a;
}

int isEmpty(){
  if(head==tail) return 1;
  else return 0;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  head = 1;
  tail = n+1;

  while(isEmpty()==0){
    u = dequeue();
    if(u.t>q){
      u.t -= q;
      enqueue(u);
      elaps += q;
    }else{
      elaps += u.t;
      printf("%s %d\n",u.name,elaps);
    }
  }
  
  return 0;
}



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

using ll = long long;

const ll MOD = 1e9 + 7;
int N;
map<int, int> mp;

int main() {
   cin >> N;

   for (int i = 2; i <= N; i++) { // N,N-1,N-2,..について各素数の個数を求める
      int x = i; // iを変更するとまずいのでxに値をコピー
      for (int j = 2; j <= x; j++) { // 素数jの個数を求める
         while (x % j == 0) {
            x /= j;
            mp[j]++;
         }
      }
   }

   ll ans = 1;
   for (auto x : mp) {
      ans = ((ans%MOD) * (x.second+1)%MOD) % MOD;
   }

   cout << ans << endl;

   return 0;
}

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

using namespace std;
using std::vector;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) gcd(b, a%b);
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a / gcd(a , b)) * b;
}

int main(){
 
  int n; cin >> n;
  ll k; cin >> k;
  vi v(64, 0);
  vector<ll> a(n, 0);

  rep(i, n){
    cin >> a[i];
    bitset<64> temp(a[i]);
    rep(j, 64){
      if(!temp[j]){
        v[j] += 1;
      }
    }
  }
  
  ll sum = 0;
  bitset<64> arr;

  for(int  i = 63; i >= 0; --i)
  {
    if(v[i] >= (n + 1) / 2 and sum + pow(2, i) <= k){
      sum += pow(2, i);
      arr.set(i);
    }
  }

  ll ans = 0;

  rep(i, n){
    ans += a[i] ^ sum;
  }

  pr(ans);
  

  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
private static Scanner s = new Scanner(System.in);
static int[] color;
static int[] f;
static int[] d;
static int[][] list;
static int time;
public static void main(String[] args) {
	int n = s.nextInt();
	int u,k,v;
	d = new int[n];
	f = new int[n];
	color = new int[n];
	list = new int[n][n];

	for(int i = 0;i < n;i++) {
		u = s.nextInt();
		k = s.nextInt();
		while(k > 0) {
			v = s.nextInt();
			list[u-1][v-1] = 1;
			k--;
		}
	}
	dfs(n);
	for(int i = 0;i < n;i++) {
		System.out.println(i+1 + " " + d[i] + " " + f[i]);
	}

}

static void dfs(int n) {
	for(int i = 0;i < n;i++) {
		color[i] = 0;
	}
	time = 0;
	for(int i = 0;i < n;i++) {
		if(color[i] == 0) {
			visit(n,i);
		}
	}
}

static void visit(int n,int u) {
	color[u] = -1;
	d[u] = ++time;
	for(int i = 0;i < n;i++) {
		if(color[i] ==0 && list[u][i] ==1 ) {
			visit(n,i);
		}
	}
		color[u] = 1;
		f[u] = ++time;

}
}



Measured memory_bytes: 28240
#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;
#define N 10000000
int main(){
	int *a;
	int b;
	int i, j, p;
	int c[100000];
	int d[100000];
	a = new int[N];
	p = 1;
	while (1==1){
		scanf("%d", &c[p]);
		if(c[p]!=0)p++;
		else break;
	}
		b = (int)pow(N, 0.5);
		a[0] = -1;
		for (i = 2; i <= b; i++){
			for (j = 2; j <= N/ i; j++){
				a[i*j - 1] = -1;
			}
		}
	for (i = 1; i < p; i++){	
		for (j = c[i];j>0; j--){
			if (a[j - 1] != -1){ 
				if (a[j - 2 - 1] != -1 && a[j - 6 - 1] != -1 && a[j - 8 - 1] != -1){
					d[i] = j;
					j = 0;
				}
			}
		}
		printf("%d\n", d[i]);
	}
	delete[] a;

	return 0;
}

Measured memory_bytes: 40172
import java.io.*;
 
public class Main {
 public static void main(String args[]) throws IOException {
  BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
  String bs=b.readLine();
  try{
   int bi=Integer.parseInt(bs);
   int x=bi;
   for(int i=0;i<2;i++){
    x=x*bi;
   }
   System.out.println(x);
  }catch(NumberFormatException e){
      e.printStackTrace();
  }
 }
}

Measured memory_bytes: 24300
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}
ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll com(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cominit();
    ll n,k;
    ll ans=0;
    cin>>n>>k;
    ll a[n];
    
ll niko[2002];
    memset(niko,0,sizeof(niko));
    for(int i=0;i<n;i++){
        cin>>a[i];
        niko[a[i]]++;

    }
   
    ll maki[2002][2002];
    for(int i=0;i<=2000;i++){
        for(int j=0;j<=2000;j++){
            maki[i][j]=0;
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=1;j<a[i];j++){
            maki[i][j]=1;
        }
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<=2000;j++){
            maki[i][j]+=maki[i-1][j];
        }
    }
    for(int i=0;i<n;i++){
        ans+=maki[i][a[i]];
        ans%=mod;
    }
    ans*=k;
    ans%=mod;


    ///////



    
    ll umi[2002];
    memset(umi,0,sizeof(umi));
    for(int i=0;i<2002;i++){
        umi[i]=niko[i];
    }
    for(int i=1;i<2002;i++){
        niko[i]+=niko[i-1];
    }
    ll honoka=((k*(k-1))/2)%mod;
    for(int i=1;i<2001;i++){
        ans+=(((honoka*umi[i])%mod)*niko[i-1])%mod;
        ans%=mod;
    }
    cout << ans<<endl;
    return 0;
}



Measured memory_bytes: 36352
#include <bits/stdc++.h> 
#include <string.h> 
#include <iostream> 
using namespace std; 
int main() 
{ 
    long double n;cin>>n;
  long double k;
  k=n*n*n;
  cout << fixed << setprecision(10)<<k/27<<endl;
 
    return 0; 
} 

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
using namespace std;
int ok[55],p[55],a[55],b[55];
int n,i,j,k;
bool futai;
bool check()
{
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=50;j++)
            ok[j]=0;
        ok[a[i]]=1;
        for(j=50;j>=1;j--)
            if(p[j])
               for(k=0;k<=50;k++)
                    if(ok[k])
                       ok[k%j]=1;
        if(!ok[b[i]]) return 0;
    }
    return 1;
}
int main()
{
    //freopen("data.in","r",stdin);
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=n;i++)
        cin>>b[i];
    for(i=1;i<=50;i++)
        p[i]=1;
    if(!check())
    {
        cout<<"-1";
        return 0;
    }
    for(int pu=50;pu>=0;pu--)
    {
        p[pu]=0;
        if(!check()) p[pu]=1;
    }
    futai=1;
    check();
    long long ans=0;
    for(long long pp=1;pp<=50;pp++)
        if(p[pp])
            ans+=(1LL<<pp);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static String[] mySplit(String str){return str.split("");}
        public static void main(String[] args){
          long N = getLong();
          int P = getInt();
            boolean isOdd = false;
            for(int i = 0; i < N; i++){
              int a = getInt();
              if(a % 2 == 1){
                isOdd = true;
              }
            }
            if(isOdd){
              myout(originPow(new Long(2),N - 1));
            }else{
              if(P == 0){
                myout(originPow(new Long(2),N));
              }else{
                myout(0);
              }
            }
          
        }
        //Method addition frame start
static long originPow(long x, long n) {return originPow(x,n,-1);}
static long originPow(long x, long n,int m) {
        long ans = 1;
        while (n > 0) {
                if ((n & 1) == 1){
                  ans = ans * x;
                  if(m != -1){ans %= m;}
                }
                x = x * x;
          		if(m != -1){x %= m;}
                n >>= 1;
        }
        return ans;
}
        //Method addition frame end
}


Measured memory_bytes: 21716
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
import copy
Z = copy.deepcopy(A)
#for i in range(1, N):
 #   Z.append(abs(A[i] - A[i - 1]))
Z.sort()
i = 0

while True:
    if i >= len(Z):
        break
    if Z[i] == 0:
        del Z[i]
        i -= 1
    elif i > 0 and Z[i] == Z[i - 1]:
        del Z[i]
        i -= 1
    i += 1

ans = -1

import fractions
gcd = Z[0]
for i in range(1, len(Z)):
    gcd = fractions.gcd(gcd, Z[i])

if K % gcd == 0:
    ans = 1
    
if K > max(A):
    ans = -1
       
for i in A:
    if K == i:
        ans = 1
        break

if ans == -1:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Measured memory_bytes: 14224
from math import sqrt

n = int(input())
total = 0
p = []
for _ in range(n):
    x, y = map(int, input().split())
    p.append([x, y])

for i in range(n - 1):
    for j in range(i, n):
        xi, yi = p[i]
        xj, yj = p[j]
        total += sqrt((xi -xj) ** 2 + (yi - yj) ** 2)

ans = total / n * 2
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
#define WHITE 0
#define BRACK 1
 
int **matrix;
int *d;
int *parent;
int *color;
 
 
void dijkstra(int n){
  int mincost;
  int i,j,u;
 
  for(i=0;i<n;i++){
    d[i] = INT_MAX;
    parent[i] = -1;
    color[i] = WHITE;
  }
 
  d[0] = 0;
 
  while(1){
    mincost = INT_MAX;
 
    for(i=0;i<n;i++){
      if(color[i] != BRACK && d[i] < mincost){
    mincost = d[i];
    u = i;
      }
    }
 
    if(mincost == INT_MAX) break;
 
    color[u] = BRACK;
 
    for(i=0;i<n;i++){
      if(color[i] != BRACK && matrix[u][i] != -1 && matrix[u][i] + d[u] < d[i]){
    d[i] = matrix[u][i] + d[u];
    parent[i] = u;
      }
    }
  }
}
int main(){
  int n,i,j,k,u,v;
  scanf("%d",&n);
 
  color =  malloc(n * sizeof(int ));
  d =  malloc(n * sizeof(int ));
  parent = malloc(n * sizeof(int));
 
  matrix = malloc(n * sizeof(int *));
  for(i=0;i<n;i++)
    matrix[i] = malloc(n * sizeof(int));
 
  for(i=0;i<n;i++)
    for(j=0;j<n;j++)
      matrix[i][j] = -1;
   
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      scanf("%d",&matrix[u][v]);
    }
  }
 
  dijkstra(n);
 
  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
 
  free(d);
  free(color);
  free(parent);
  for(i=0;i<n;i++) free(matrix[i]);
  free(matrix);
 
  return 0;
   
}
 
 

Measured memory_bytes: 640
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0090
//
#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define np string::npos
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)

typedef long long ll ;

const double EPS = 1e-10;
const double INF = 1e12;
typedef complex<double> P;//?????´????°?????????¢??????????????????¨??§?£???
namespace std {
  bool operator < (const P& a, const P& b) {//x????????????
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
  bool sorty(const P& a, const P& b) {//y????????????
    return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b);
  }
}

typedef vector<P> G;

struct C {//???
  P p; double r;
  C(){};
  C(const P &p, double r) : p(p), r(r) { }
};
// L:line,S:segment,P:point
double distancePP(const P &p,const P &q){
  return abs(p - q) ;
}
P verticalvector(const P &a,const P &b){//2???????????????????????????????????????
  if(a.real() == b.real()){
    return {1.0,0};
  }
  if(a.imag() == b.imag()){
    return {0,1.0};
  }
  P p = a - b;
  P res = {-p.imag(),p.real()};
  return res / abs(p);
}
pair<P,P> crosspointCircle(const C &a,const C &b){
  P m = (a.p+b.p)/2.0;
  P vv = verticalvector(a.p,b.p);
  double u = sqrt( a.r * a.r - norm(a.p - b.p) / 4.0);
  P A = m + u * vv,B = m - u * vv;
  return mp(A,B);
}
int n;
C ps[100];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  char c;
  while(1){
    cin >> n;
    if(n == 0){
      break;
    }
    double x,y;
    rep(i,n){
      cin >> x >> c >> y ;
      ps[i] = {P(x,y),1.0};
    }
    int ans = 1,resa=0,resb = 0;
    rep(i,n){
      REP(j,i+1,n){
        if(distancePP(ps[i].p,ps[j].p) >= 2.0){
          continue ;
        }
        else{
          auto ab = crosspointCircle(ps[i],ps[j]);
          P a = ab.first,b = ab.second;
          resa = 0;
          resb = 0;
          rep(k,n){
            if(distancePP(ps[k].p,a) <= 1.0 + EPS){
              ++resa;
            }
          }
          rep(k,n){
            if(distancePP(ps[k].p,b) <= 1.0 + EPS){
              ++resb;
            }
          }
        }
        ans = max(ans,max(resa,resb));
      }
    }
    std::cout << ans << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3212
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <complex>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

typedef long double ld;
typedef complex<ld> P;
const double eps = 1e-10;
ld cross(const P& a, const P& b) { return a.real()*b.imag() - a.imag()*b.real(); }
ld dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }


// https://tubo28.me/compprog/algorithm/minball/
template <class iter>
std::pair<P, ld> min_ball(iter left, iter right, int seed = 1333) {
    const int n = right - left;

    assert(n >= 1);
    if (n == 1) {
        return {*left, ld(0)};
    }

    std::mt19937 mt(seed);
    std::shuffle(left, right, mt);
    // std::random_shuffle(left, right); // simple but deprecated

    iter ps = left;
    using circle = std::pair<P, ld>;

    auto make_circle_3 = [](const P &a, const P &b, const P &c) -> circle {
        ld A = std::norm(b - c), B = std::norm(c - a), C = std::norm(a - b),
           S = cross(b - a, c - a);
        P p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4 * S * S);
        ld r2 = std::norm(p - a);
        return {p, r2};
    };

    auto make_circle_2 = [](const P &a, const P &b) -> circle {
        P c = (a + b) / (ld)2;
        ld r2 = std::norm(a - c);
        return {c, r2};
    };

    auto in_circle = [](const P &a, const circle &c) -> bool {
        return std::norm(a - c.first) <= c.second + eps;
    };

    circle c = make_circle_2(ps[0], ps[1]);

    // MiniDisc
    for (int i = 2; i < n; ++i) {
        if (!in_circle(ps[i], c)) {
            // MiniDiscWithPoint
            c = make_circle_2(ps[0], ps[i]);
            for (int j = 1; j < i; ++j) {
                if (!in_circle(ps[j], c)) {
                    // MiniDiscWith2Points
                    c = make_circle_2(ps[i], ps[j]);
                    for (int k = 0; k < j; ++k) {
                        if (!in_circle(ps[k], c)) {
                            c = make_circle_3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<P> a(n);
  REP(i, 0, n) {
    int x, y;
    cin >> x >> y;
    a[i] = P(x, y);
  }
  auto ans = min_ball(a.begin(), a.end());
  cout << fixed << setprecision(15) << sqrt(ans.second) << endl;
}


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

int ara[4][4];
int ase[4][4];

int main( )
{
    int i, j, k;
    for (i = 1; i <= 3; i++) {
        for (j = 1; j <= 3; j++) {
            cin >> ara[i][j];
        }
    }
    int q;
    cin >> q;
    while (q--) {
        cin >> k;
        for (i = 1; i <= 3; i++) {
            for (j = 1; j <= 3; j++) {
                if (ara[i][j] == k) {
                    ase[i][j] = 1;
                }
            }
        }
    }
    int fl = 0;
    for (i = 1; i <= 3; i++) {
        if (ase[i][1] == 1 && ase[i][2] == 1 && ase[i][3] == 1) {
            fl = 1;
            break;
        }
    }
    for (i = 1; i <= 3; i++) {
        if (ase[1][i] == 1 && ase[2][i] == 1 && ase[3][i] == 1) {
            fl = 1;
            break;
        }
    }
    if (ase[1][1] == 1 && ase[2][2] == 1 && ase[3][3] == 1) {
        fl = 1;
    }
    if (ase[1][3] == 1 && ase[2][2] == 1 && ase[3][1] == 1) {
        fl = 1;
    }
    if (fl) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}



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

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int n = 7;
  vector<int> vec (n,0);
  for (int i = 0; i < n; i++)
  {
     cin>>vec[i];
  }
  int res1 = 0;
  res1 += vec[0]/2*2;
  res1 += vec[1];
  res1 += vec[3]/2*2;
  res1 += vec[4]/2*2;
  int res = 0;
  if(vec[0] >= 1 and vec[3] >= 1 and vec[4] >= 1)
  {
    res += 3;
    vec[0] --;
    vec[3] --;
    vec[4] --;
  }
  res += vec[0]/2*2;
  res += vec[1];
  res += vec[3]/2*2;
  res += vec[4]/2*2;

  // res += min(vec[2],min(vec[5],vec[6]))*
  cout<<max(res1,res)<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)(1e9+1)
#define MOD (long long)(1e9+7)
#define INF64 (long long)(1e18+1)

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

llint my_binary_search(llint ary[], llint key, llint left, llint right) {
	llint middle;
	if (right < left) {
		return -(INF64);
	} else {
		middle = left + (right - left) / 2;
		if (ary[middle] > key) {
			return my_binary_search(ary, key, left, middle - 1);
		} else if (ary[middle] < key) {
			return my_binary_search(ary, key, middle + 1, right);
		} else {
			return middle;
		}
	}
}

struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	
	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for(int i = 0; i < N; i++) par[i] = i;
	}
	
	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
	
	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}
	
	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main (void)
{
	//INPUT
	llint N,K,R,S,P;
	cin >> N >> K >> R >> S >> P;
	string T;
	cin >> T;
	llint len;
	len = T.length();
	
	
	//SOLVE
	llint ans=0;
	llint buf;
	
	
	// K回前も同じのだったら点数加算しないとすればOKか。
	for(llint j=0;j<K;j++) {
		if (T[j] == 'r') {
			ans+=P;
		} else if (T[j] == 's') {
			ans+=R;
		} else if (T[j] == 'p') {
			ans+=S;
		}
		buf = 1; //前回かってる
		for(llint i=j+K;i<N;i+=K) {
			if (T[i] == T[i-K]) {
				if (buf == 1) {
					buf = 0;
					//make
				} else {
					if (T[i] == 'r') {
						ans+=P;
					} else if (T[i] == 's') {
						ans+=R;
					} else if (T[i] == 'p') {
						ans+=S;
					}
					buf = 1;
					//kati
				}
			} else {
				
					if (T[i] == 'r') {
						ans+=P;
					} else if (T[i] == 's') {
						ans+=R;
					} else if (T[i] == 'p') {
						ans+=S;
					}
					buf = 1;
					//kati
			}
			
		}
	}
	
	// rep(i,0,len) {
	// 	if (T[i] == 'r') {
	// 		if (i>=K) {
	// 			//K回前存在する
	// 			if (T[i-K] == T[i]) {
	// 				//勝てない
	// 			}
	// 		} else {
	// 		}
	// 	} else if (T[i] == 's') {
	// 
	// 	} else {
	// 
	// 	}
	// }
	
	
	//OUTPUT
	cout << ans << endl;
	
	return 0;
}






Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  long long x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    if(x/d>=k)cout<<x-k*d;
    else {
      k-=x/d;
      if(k%2)cout<<d-x%d;
      else cout<<x%d;
    }
  return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

ll rec (ll a, ll b, ll c, ll n) {
    if (a%2 || b%2 || c%2) {
        return n;
    }

    if (a == b && b == c) {
        return -1;            
    }

    rec((b+c)/2, (c+a)/2, (a+b)/2, n+1);
}

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

    ll A, B, C;
    cin >> A >> B >> C;

    cout << rec(A, B, C, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL gcd(LL a,LL b)
{
    while(b)
    {
        LL tmp=b;
        b=a%b;
        a=tmp;
    }
    return a;
}
int main()
{
    LL n,x;
    while(scanf("%lld%lld",&n,&x)!=EOF)
    {
        LL tmp=gcd(n,x);
        printf("%lld\n",(3*(n/tmp-1))*tmp);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1);
	return 0;
}

//Ctrl+Aを使わない

Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int, input().split()))
    C = [0] * (N+1)
    Cnt_A = [0] * (N+1)
    for a in A:
        Cnt_A[a] += 1
        cnt = Cnt_A[a]
        C[cnt] += 1
    cum_C = []
    cu = 0
    for c in C:
        cu += c
        cum_C.append(cu)
    Ans = []
    for k in range(1, N+1):
        # K = k のとき、 n 組以上作れる <=> 使えるカードが nk 枚以上
        # n 組以上作れる <=> 同じカードは n 枚以下
        # 同じカードは n 枚以下で全体として nk 枚以上用意できるか？
        ok, ng = 0, N//k+1
        while ok + 1 < ng:
            n = ok+ng>>1
            if cum_C[n] >= n*k:
                ok = n
            else:
                ng = n
        Ans.append(ok)
    print("\n".join(map(str, Ans)))

main()


Measured memory_bytes: 61836
import sys

n,k = map(int,input().split())
s = input()

# zero[i] = [左からi番目連続した0の数, 左の連続した1の数,右の連続した1の数]
# s=00010 の時、zero=[[3, 0, 1], [1, 1, 0]]
zero = []
string = s[0]
count = 0; left = 0; right = 0; num = 0
for i in range(n):
	if s[i] == string:
		count += 1
	else:
		if string == '0':
			num = count
			string = '1'
		else:
			if num != 0:
				zero.append([num,left,count])
			string = '0'
			left = count
			num = 1
		count = 1

# 右端の数字が0か1かで処理が変わる
if string == '0':
	zero.append([count,left,0])
else:
	zero.append([num,left,count])

# kが十分に大きければ全員逆立ちする
if len(zero) <= k:
	print(len(s))
	sys.exit()

# 左からk個の連続した0を全て1にしたときの、
# 連続した1の個数をresに格納
res = 0
for i in range(k):
	res += zero[i][0] + zero[i][1]
res += zero[i][2]

# 左端を削除し、右端に1つ追加する
# 多分しゃくとり法
ans = res
for i in range(len(zero)-k):
	res -= zero[i][0] + zero[i][1]
	res += zero[i+k][0] + zero[i+k][2]
	ans = max(ans,res)

print(ans)


Measured memory_bytes: 8180
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
int n,p;
bool f(int a)
{
	if(a<2)return 0;
	for(int i=2;i*i<=a;i++)if(a%i<1)return 0;
	return 1;
}
main()
{
	while(cin>>n>>p,n>=0)
	{
		vector<int>P;
		int u=p;
		for(int i=n+1;u;i++)
		{
			if(f(i))
			{
				u--;
				P.push_back(i);
			}
		}
		vector<int>a;
		for(int i=0;i<p;i++)for(int j=i;j<p;j++)a.push_back(P[i]+P[j]);
		sort(a.begin(),a.end());
		cout<<a[p-1]<<endl;
	}
}


Measured memory_bytes: 3140
#include<stdio.h>

int main(void){
        int S, h, m, s;
        printf("");
        scanf("%d", &S);
        if(S>=0 && S<86400){
                h=S/3600;
                m=(S%3600)/60;
                s=(S%3600)%60;
                printf("%d:%d:%d\n", h, m, s);
        }
        return 0;
}

Measured memory_bytes: 592
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define INF 1000000000

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  vector<int> cost(201, 0);
  for (int i = 0; i < N; i++) {
    for (int j = -100; j <= 100; j++) {
      cost[j + 100] += (a[i] - j) * (a[i] - j);
    }
  }

  int answer = INF;

  for (int j = -100; j <= 100; j++) {
    if (answer > cost[j + 100]) answer = cost[j + 100];
  }

  cout << answer << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <queue>
#include <cstring>
#include <iostream>
#include <algorithm>
#define debug(x) cout<<#x<<" = "<<x<<endl;
using namespace std;
typedef long long LL;
inline int read()
{
	int l = 0, f = 1;
	char a = getchar();
	for (; a < '0' || a > '9'; a = getchar())
		if (a == '-') f = -1;
	for (; a >= '0' && a <= '9'; a = getchar())
		l = l * 10+a-48;
	return l * f;
}
int n, a, mx = -1, mn = 2333333;
int main()
{
	n = read();
	for (int i = 1; i <= n; ++i)
	{
		a = read();
		mx = max(mx, a);
		mn = min(mn, a);
	}
	printf("%d\n", mx-mn);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    for(int i=0;i<10;i++)
    {
        int tmp;
        tmp=a*c-b;
        c=tmp;
        cout<<tmp<<endl;
    }
    return 0;
}


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

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

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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; }

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

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

  cout << (a*b%2==0 ? "Even" : "Odd")  << endl;
  return 0;
} 

Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N, K;
    cin >> N >> K;
    vector<ll> h(N);
    for(size_t i=0;i<N; i++)
    {
        cin >> h[i];
    }
    sort(h.begin(), h.end());
    ll min_dist=INF;
    for(int i=0;i<=N-K; i++)
    {
        ll dist=h[i+K-1]-h[i];
        min_dist=min(min_dist, dist);
    }
    cout << min_dist << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3928
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int a = scn.nextInt(), b = scn.nextInt(), c = scn.nextInt();
        System.out.println(a < b && b < c ? "Yes" : "No");
    }
}

Measured memory_bytes: 26348
#include<bits/stdc++.h>
using namespace std;
int n,c,l[10];
double dp[500][(1<<7)],t,ans;
int main()
{
	scanf("%d%d",&n,&c);
	for(int i=0;i<n;++i)
	scanf("%d",&l[i]);
	sort(l,l+n);
	do
	{
		memset(dp,0,sizeof(dp));
		dp[l[n-1]*n][0]=1;
		for(int i=0;i<=n*c;++i)
		for(int j=i;j<=n*c;++j)
		for(int S=0;S<(1<<n-1);++S)
			if(i%n and !((S>>(i%n-1))&1))
				dp[min(n*c,max(j,i+l[i%n-1]*n))][S|(1<<(i%n-1))]+=dp[j][S];
		ans+=dp[n*c][(1<<n-1)-1];
		t++;
	}
	while(next_permutation(l,l+n-1));
	printf("%.15lf",(double)ans/t/pow(c,n-1));
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

int N,M,Q;
VVI hozo;

void dfs(VI x, int now){
    if(SZ(x) == N){
        hozo.eb(x);
        return;
    }

    for(int i = now; i <= M; i++){
        VI tmp = x;
        tmp.eb(i);
        dfs(tmp,i);
    }
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    cin >>N>>M>>Q;
    VI a(Q),b(Q),c(Q),d(Q);
    REP(i,Q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    VI emp;
    dfs(emp,1);
    LL ans = -INF;
    for(auto x : hozo){
        LL tmp = 0;
        REP(i,Q){
            if(x[b[i]]-x[a[i]] == c[i]) tmp += d[i];

        }
        chmax(ans,tmp);
    }
    cout << ans << endl;

}

Measured memory_bytes: 9820
#include <bits/stdc++.h>
using namespace std;
long long int N, final_result;
int main(){
	//freopen("test.in", "r+", stdin);
	cin >> N;
	for(long long int d = 1; d * d <= N; d++){
		if(N % d != 0)continue;

		long long int div = d;
		//cout << div << " g\n";
		if(div > 1 && N / (div - 1) * div == N)final_result += div - 1;

		div = N / d;
		//cout << div << " g\n";
		if(div > 1 &&  N / (div - 1) * div == N)final_result += div - 1;

	}
	cout << final_result << '\n';
	
}

Measured memory_bytes: 256
import sys
 
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]
 
flagN = [False]*N
numN = [0]*N
if N > 1:
  numN[0] = 1

for sc in SC:
  s, c = sc[0], sc[1]
  if flagN[s-1] == False:
    flagN[s-1] = True
    numN[s-1] = c
  elif numN[s-1] == c:
    continue
  else:
    print(-1)
    sys.exit()
    
if N != 1 and numN[0] == 0:
  print(-1)
  sys.exit()

ans = ''
for n in numN:
  ans += str(n)
print(ans)

Measured memory_bytes: 61848
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	n--;
	vector<int> c(n), s(n), f(n);
	for(int i = 0; i < n; ++i) {
		cin >> c[i] >> s[i] >> f[i];
	}
	
	for(int i = 0; i < n; ++i) {
		int t = c[i] + s[i];
		
		for(int j = i + 1; j < n; ++j) {
			if( t < s[j] ) { 
				t += s[j] - t;	
			} else if( t > s[j] && t % f[j] != 0 ) { 
				t += (f[j] - t % f[j]);
			}
			
			t += c[j];
		}
		
		cout << t << endl;
	}
	
	cout << 0 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  int cnt = 0;

  rep(i, n) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'T'|| s[i] == 'G') {
      cnt++;
    } else {
      cmax(ans, cnt);
      cnt = 0;
    }
  }
  cmax(ans, cnt);
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
results = []
for i in range(1,N+1):
  con = input()
  results.append(con)
A = results.count("AC")
W = results.count("WA")
T = results.count("TLE")
R = results.count("RE")
print("AC x {}".format(A))
print("WA x {}".format(W))
print("TLE x {}".format(T))
print("RE x {}".format(R))

Measured memory_bytes: 16188
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
  vector<bool> ansvec(101, false);
  for(int i = 0; i * 4 <= 100; i++) {
    for(int j = 0; j * 7 <= 100; j++) {
      if(4 * i + 7 * j > 100) {
        continue;
      }
      ansvec[4 * i + 7 * j] = true;
    }
  }
  int N;
  cin >> N;
  if(ansvec[N]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
c = list(input())

if N <= 1:
    print(0)
else:
    ans = 0
    r = N
    for w in range(N):
        if c[w] == 'R':
            continue
        else:
            while True:
                r += -1
                if r == -1 or c[r] == 'R':
                    break
            if r < w:
                break
            else:
                ans += 1
    print(ans)

Measured memory_bytes: 10692
k,x = map(int,input().split())
y = x
ans = []
for i in range(k-1):
    ans.append(y-1)
    y -= 1
y = x
for i in range(k):
    ans.append(y)
    y += 1
ans = sorted(ans)
for i in ans:
    print(i,end=" ")
print()


Measured memory_bytes: 3060