akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d) << endl;
}

int main() {
    solve();
    
    return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> s(M), c(M);
  for(int i=0; i<M; i++) cin >> s[i] >> c[i];
  int upper = 1;
  int lower = 0;
  for(int i=0; i<N; i++){
    lower=upper;
    upper*=10;
  }
  if(N==1)lower = 0;
  int ans=999;
  bool ff = true;
  for(int i=upper; i>=0; i--){
    string an = to_string(i);
    bool flag = true;
    for(int k=0; k<M; k++){
      string b = to_string(c[k]);
      flag = flag && an[s[k]-1]==b[0];
    }
    if(flag){
      if(i<lower) break;
      ans = min(ans, i);
      ff = false;
    }
  }
  if(ff)ans = -1;
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main() {
    int A,B;
    string S;
    cin>>A>>B>>S;

    if(S[A]!='-'){
        cout<<"No"<<endl;
        return 0;
    }

    for(int i=0;i<A+B+1;i++){
        if(i!=A){
            if(!(isdigit(S[i]))){
                cout<<"No"<<endl;
                return 0;
            }

        }
    }

    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

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

    string c;

    cin >> c;
    
    ll r = 0;

    for (int i = 0; i < n; i++)
    {
        if (c[i] == 'R')
        {
            r++;
        }
    }

    ll w = 0;

    for (int i = 0; i < r; i++)
    {
        if (c[i] == 'W')
        {
            w++;
        }
    }

    cout << w << endl;
}


Measured memory_bytes: 3752
#-*- coding:utf-8 -*-
import sys

#入力されたデータに関して携帯のキーを返す
def decode_keitai(str):

    #携帯キーを表す配列を作成
    keitai_keys = [" ","',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"]

    #結果文字列
    results = []

    #入力文字列をリストに変換
    inputs = str.split("\n")

    #各文字列について
    for input in inputs:

        input = input.replace("\n","")
        result = "" #デコード結果
        #前の文字
        s_before = ""

        #文字列の最後まで
        while len(input) > 0:

            #文頭の1文字を取得
            s = input[0]
            input = input[1:]

            #最初の1文字ならcontinue
            if s_before == "":
                s_before = s
                continue

            #最初の1文字が前の文字と違うなら携帯コードにデコード
            if not s in s_before:
                if s_before[0] == "0":
                    result += s_before[:-1].replace("0"," ")
                else:
                    id = int(s_before[0])
                    keylen = len(keitai_keys[id])
                    result += keitai_keys[id][(len(s_before)-1)%keylen]
                s_before = s
            else:
                s_before += s
            

        #最後に残った文字列を変換
        if len(s_before) > 0:
            if s_before[0] == "0":
                result += s_before[:-1].replace("0"," ")
            else:
                id = int(s_before[0])
                keylen = len(keitai_keys[id])
                result += keitai_keys[id][(len(s_before)-1)%keylen]
            s_before = ""

        results.append(result)

    return "\n".join(results)

if __name__=="__main__":
    lines = []
    for line in sys.stdin:
        lines.append(line.replace("\n",""))
    print decode_keitai("\n".join(lines))

Measured memory_bytes: 4292
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

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

    vector<pii> edge[k];
    for (int i=0; i<k; ++i)
    {
        edge[i].emplace_back((i+1)%k, 1);
        edge[i].emplace_back((i*10)%k, 0);
    } 

    priority_queue<pii, vector<pii>, greater<pii>> que;
    vector<bool> visited(k, false);
    que.push(make_pair(1, 1));
    while(que.size() > 0)
    {
        int d, now;
        tie(d, now) = que.top();
        que.pop();

        if (now == 0)
        {
            cout << d << endl;
            return 0;
        }
        if (visited[now]) continue;
        visited[now] = true;
        // cout << now << ' ' << d << endl;

        for (auto next_w: edge[now])
            que.push(make_pair(d+next_w.second, next_w.first));
    }
    return 0;
}

Measured memory_bytes: 6904
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

int main() {
	int e;
	while(cin >> e, e) {
		int res = e;
		for(int z=0; z*z*z<=e; z++) {
			int ze = e - z*z*z;
			int y = floor(sqrt(ze));
			ze -= y*y;
			res = min(res, z+y+ze);
		}

		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <assert.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

#define inf 1000000007
#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;

class path {
public:
  int t;
  ll c;
  int p;
};

class dinic {
public:
  int n;
  vector<path> p;
  vector<int>* v;
  int* l;
  int* o;
  dinic(int nw) {
    n = nw;
    v = new vector<int>[n];
    l = new int[n];
    o = new int[n];
  }
  void add(int from, int to, ll cap) {
    assert(from < n);
    assert(to < n);
    path w1, w2;
    w1.t = to;
    w1.c = cap;
    w1.p = p.size() + 1;
    v[from].push_back(p.size());
    w2.t = from;
    w2.c = 0;
    w2.p = p.size();
    v[to].push_back(p.size() + 1);
    p.push_back(w1);
    p.push_back(w2);
  }
  void dics(int from) {
    rep(i, n) {
      l[i] = inf;
    }
    priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pq;
    pq.push(make_pair(0, from));
    while(!pq.empty()) {
      int k = pq.top().first;
      int m = pq.top().second;
      pq.pop();
      if(l[m] > k) {
        l[m] = k;
        rep(i, v[m].size()) {
          int x = v[m][i];
          if(p[x].c > 0) {
            pq.push(make_pair(k + 1, p[x].t));
          }
        }
      }
    }
  }
  ll dfs(int now, int to, ll mi) {
    if(now == to) {
      return mi;
    }
    ll all = 0;
    while(o[now] < v[now].size()) {
      int x = v[now][o[now]];
      if(l[p[x].t] == l[now] + 1) {
        ll w = dfs(p[x].t, to, min(mi - all, p[x].c));
        p[x].c -= w;
        p[p[x].p].c += w;
        all += w;
        if(mi - all == 0) {
          break;
        }
      }
      o[now]++;
    }
    return all;
  }
  ll solve(int from, int to) {
    assert(from < n);
    assert(to < n);
    ll all = 0;
    while(1) {
      dics(from);
      rep(i, n) {
        o[i] = 0;
      }
      ll w = dfs(from, to, inf);
      all += w;
      if(w == 0) {
        break;
      }
    }
    return all;
  }
  ~dinic() {
    delete[] v;
    delete[] l;
    delete[] o;
  }
};

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

ll nd[1000], md[1000];

int main() {
  while(1) {
    int n, m;
    scanf("%d%d",&n,&m);
    if(n == 0) {
      break;
    }
    rep(i, n) {
      scanf("%lld", nd + i);
    }
    rep(i, m) {
      scanf("%lld", md + i);
    }
    dinic s(2 + n + m);
    rep(i, n) {
      s.add(n + m, i, 1);
    }
    rep(i, m) {
      s.add(n + i, n + m + 1, 1);
    }
    rep(i, n) {
      rep(j, m) {
        if(gcd(nd[i], md[j]) > 1) {
          s.add(i, n + j, 1);
        }
      }
    }
    printf("%lld\n", s.solve(n + m, n + m + 1));
  }
}

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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;

	for (int i = 0; i < dy; i++) putchar('U');
	for (int i = 0; i < dx; i++) putchar('R');

	for (int i = 0; i < dy; i++) putchar('D');
	for (int i = 0; i < dx; i++) putchar('L');

	putchar('L');
	for (int i = 0; i < dy; i++) putchar('U');
	putchar('U');
	for (int i = 0; i < dx; i++) putchar('R');
	putchar('R');
	putchar('D');

	putchar('R');
	for (int i = 0; i < dy; i++) putchar('D');
	putchar('D');
	for (int i = 0; i < dx; i++) putchar('L');
	putchar('L');
	putchar('U');
}

Measured memory_bytes: 256
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h> 
 
using namespace std;
 
 
#define         ll                         long  long
#define         lf                         double 
#define         pb(x)                      push_back(x)
#define         ull                        unsigned long long
#define         sfl(a)                     scanf("%lld",&a)
#define         sf(a)                      scanf("%d",&a)
#define         pf(a)                      printf("%d\n",a)
#define         pfl(a)                     printf("%lld\n",a)
#define         pdl(a)                     printf("%llf\n",a)
#define         FOR(x,n)                   for(ll x=1;x<=n;++x)
#define         vii                        vector< ll > v
#define         pi                         3.14159265359
#define         mex                        10000000
#define         pii                        pair< ll , ll >
#define         mem(m,a)                   memset( m, a,sizeof m)
#define         mp(a,b)                    make_pair(a,b)
#define         maxn                       100000
#define         mod                        1000000007
#define         INF                        1e17
#define         f1                         first
#define         f2                         second
#define         all(v)                     v.begin(),v.end()
#define         PI                         acos(-1)
#define         printminusone              printf("-1\n")
#define         bug                        printf("bug")
#define         FILEIN                     freopen("in.txt","r",stdin)
#define         FILEOUT                    freopen("out.txt","w",stdout)

#define N 100005
vector<ll>edge[N];
map < pair<ll,ll> , ll > mm;
ll ANS[N],mx=0;
bool vis[N];
void BFS(){
    queue<pii>q;
    vis[1]=1;
    q.push(mp(1,0));
    ll c;
    while(!q.empty()){
        pii u = q.front();
        q.pop();
        c=1;
        for( auto v : edge[u.f1] ){
            if(!vis[v]){
                vis[v]=1;
                if(u.f2!=c){
                    q.push(mp(v,c));
                    ANS[mm[mp(u.f1,v)]]=c;
                    c++;
                }
                else{
                    c++;
                    q.push(mp(v,c));
                    ANS[mm[mp(u.f1,v)]]=c;
                    c++;
                }
            }
        }
        mx=max(mx,c-1);
    }
}
int main(){
    ll n,u,v;
    sfl(n);
    for(ll i=1;i<=n-1;i++){
        sfl(u),sfl(v);
        edge[u].pb(v);
        edge[v].pb(u);
        mm[mp(u,v)]=i;
        mm[mp(v,u)]=i;
    }

    BFS();
    pfl(mx);
    for(ll i=1;i<n;i++){
        pfl(ANS[i]);
    }
    return 0;
}

Measured memory_bytes: 19996
from operator import itemgetter

n = int(input())
red = []
blue = []
ans = 0
for i in range(n):
    red.append(list(map(int, input().split())))
for i in range(n):
    blue.append(list(map(int, input().split())))

# 青点を左から見ていって、その青点より左にありかつ一番上にある赤点をペアにしていく(貪欲)
# 青点からみて下にある赤点ほどペアとしての汎用性が高い
blue = sorted(blue, key=itemgetter(0))  # x座標で昇順
red = sorted(red, key=itemgetter(0))    # x座標で昇順

for b in blue:
    max_value = -1   # minは0
    for r in red:
        if b[0] <= r[0]:  # 青点より右に赤点が合った時点で終了
            break
        else:   # 青点より左側にある赤点の中からy値が最も大きいものを探す
            if max_value < r[1] and b[1] > r[1]:
                max_value = r[1]
                max_obj = r
    if max_value != -1: # ペア候補があれば
        ans += 1
        red.pop(red.index(max_obj))

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//  インフィニティの略
const int INF = 1001001001;
//  pythonと違ってもうすでに12こあるよと設定
int a[12][12];
 
int main() {
  int n, m, x;
  cin >> n >> m >> x;
//   cの配列
  vector<int> c(n);
//   リピート変数i回数n
  rep(i,n) {
    cin >> c[i];
    rep(j,m) cin >> a[i][j];
  }
 
  int ans = INF;
//   集合s　0~-2n乗まで
  rep(s,1<<n) {
    int cost = 0;
    // 理解度の合計が超えているか
    vector<int> d(m);
    rep(i,n) {
    //   ずらした結果sのiビット目があってるか
      if (s>>i&1) {
        cost += c[i];
        rep(j,m) d[j] += a[i][j];
      }
    }
    // 真偽を決めるときはbook型デフォルトtrueで
    bool ok = true;
    // ただし3つ中1つでもx未満の物があったらxをfalseにする
    rep(j,m) if (d[j] < x) ok = false;
    if (ok) ans = min(ans, cost);
  }
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}
// リニアプログラミング
// 線型計画法（せんけいけいかくほう LP; linear programming ）は、
// 数理計画法において、いくつかの1次不等式および1次等式を満たす変数の値の中で、
// ある1次式を最大化または最小化する値を求める方法である。
// 線形計画法の対象となる最適化問題を線型計画問題

Measured memory_bytes: 3604
#include<stdio.h>

int main(){
    int a, b, c, tmp;
        scanf("%d %d %d", &a, &b, &c);
    if (a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    if (b>c){
        tmp=b;
        b=c;
        c=tmp;
    }
    if (a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}

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

int main()
{

        ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

        int t=1;
        /// cin>>t;

        while(t--)
        {
            int n,tmp;
            cin>>n;

            set<ll> s;
            for(int i=0;i<n;i++)

            {
                cin>>tmp;
                s.insert(tmp);
            }

            if(s.size()==n)
                cout<<"YES";
            else
                cout<<"NO";
        }


         return 0;

    }


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    vector<ll> cnt(5, 0);
    Rep (i, 6) {
        ll a;
        cin >> a;
        cnt[a]++;
    }

    Rep (i, 5) {
        if (cnt[i] >= 3) {
            cout << "NO\n";
            return 0;
        }
    }

    cout << "YES\n";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int n, k;

	while(scanf("%d%d", &n, &k)==2)
	{
		vi h(n);

		for(int i=0;i<n;i++)
		{
			scanf("%d", &h[i]);
		}
		sort(h.begin(), h.end());

		int ans=h[k-1]-h[0];
		for(int i=k-1;i<n;i++)
		{
			int d=h[i]-h[i-(k-1)];
			if(ans>d) ans=d;
		}
		printf("%d\n", ans);
	}

	return 0;
}


Measured memory_bytes: 640
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
while (arr.shift() != 0) {
    var a = arr.shift().split(" ").map(Number);
    a.sort(function(a, b) {
        return a - b
    });
    var min = Infinity;
    a.reduce(function(a, b) {
        min = Math.min(min, Math.abs(a - b));
        return b;
    });
    console.log(min);
}

Measured memory_bytes: 18296
#include<unordered_map>
#include<unordered_set>
#include<iostream>
#include<vector>

using ll = long long;

std::unordered_map<int, std::vector<int>> adjecent;
std::unordered_map<int, ll> node2score;
std::vector<int> sol;
std::unordered_set<int> graph;

using namespace std;

int main(void) {

    ll N;
    cin >> N;
    cout << ((N-1)*N)/2 <<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
      //入力
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      
      //計算
      double p = 0;
      int sum = 0;
      for(int i=1;i<=n;i++) {
        if(i%2!=0) sum += 1;
      }
      p=(double)sum/n;
      
      //出力
      System.out.println(p);
      
    }
      
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long int i=0;i<n;i++)
typedef long long int ll;

int main(){

    int a,b,c,d;


    cin >> a >> b >> c >> d;

    int m=min(d,b);
    int ans =0;

    for(int i=0;i<m;i++){
        if(i>=a&&i>=c){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] height = new int[N];
		int max=1;
		int ans=0;

		for(int i=0;i<N;i++) {
			height[i]=sc.nextInt();
			if(max<=height[i]) {
				max=height[i];
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int saidaikouyakusuu(int a,int b){
    if(b==0) return a;
    return saidaikouyakusuu(b,a%b);
}
int saisyoukoubaisuu(int a,int b){
    return a*b/saidaikouyakusuu(a,b);
}
int n,m,cnt=0,aa[220000],ab[220000];
pair<int,int> pp[220000];
string s,ss[220000];
char c,ca;
queue<int> que;
signed main(){
    cin>>n>>m;
    rep(i,n){
        cin>>aa[i];
        ab[max((long long)0,i-aa[i])]++;
        ab[min(n,i+aa[i]+1)]--;
    }
    rep(i,min(m,(long long)100)){
        rep(j,n){
            aa[j]=ab[j]+aa[j-1];
            ab[j]=0;
        }
        rep(j,n){
            ab[max((long long)0,j-aa[j])]++;
            ab[min(n,j+aa[j]+1)]--;
        }
    }
    rep(i,n){
        cout<<aa[i]<<' ';
    }
}

Measured memory_bytes: 13640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
const int inf=1000000007;
const int MOD=1000000007;
struct Node{
  vector<int> edge;
  bool comp;
};
signed main(){
  int n,m;cin>>n>>m;
  vector<int> k(n);
  vector<vector<int>> l(n,vector<int>(0));
  rep(i,n){
    cin>>k[i];
    rep(j,k[i]){
      int buf;cin>>buf;
      l[i].push_back(buf);
    }
  }
  vector<Node> node(n+m+1);
  rep(i,n){
    rep(j,k[i]){
      node[i].edge.push_back(l[i][j]+n-1);
      node[l[i][j]+n-1].edge.push_back(i);
    }
  }
  queue<Node> que;
  rep(i,n+m+1)node[i].comp=true;
  node[0].comp=false;
  que.push(node[0]);
  while(!que.empty()){
    Node buf=que.front();
    que.pop();
    int num=buf.edge.size();
    rep(i,num){
      if(node[buf.edge[i]].comp){
        node[buf.edge[i]].comp=false;
        que.push(node[buf.edge[i]]);
      }
    }
  }
  bool flag=false;
  rep(i,n){
    if(node[i].comp){
      flag=true;
    }
  }
  if(flag){
    cout<<"NO"<<endl;
  }
  else cout<<"YES"<<endl;
  return 0;
}


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

int main()
{
	int i, x, y, n;
	string s;
	cin >> s;
	n=s.length();
	x=0; y=0;

	for(i=0; i<n; i+=1)
	{
		string c;
		c+=s[i];
		if(i%2==0)
		{
			x+=abs(0-stoi(c));
			y+=abs(1-stoi(c));
		}
		else
		{
			x+=abs(1-stoi(c));
			y+=abs(0-stoi(c));
		}
	}

	cout << min(x, y) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,M;
  cin >> N >> M;
  long long ans =  (N-2)*(M-2);
  
  if(N==1&&M==1){
    cout << 1<<endl;
  }
  else if(N==1){
  cout << M-2<<endl;
  }
  else if(M==1){
  cout << N-2<<endl;
  }
  else if(ans<0){
  cout << 0 <<endl;
    }
  else{
  cout << ans <<endl;
  }
}


Measured memory_bytes: 3588
import scala.io.StdIn
object Main {
  def main(args:Array[String]):Unit = {
    val sec = StdIn.readLine().toInt
    val h = sec / 3600
    val m = sec % 3600 / 60
    val s = sec % 60
    println(h + ":" + m + ":" + s)
  }
}

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

typedef long long ll;

int main(){
  ll N, K;
  cin >> N >> K;
  vector<ll> a(N), b(N);
  for(int i=0; i<N; i++) cin >> a[i] >> b[i];

  vector<pair<ll,ll> > u(N);
  ll v=0;
  for(int i=0; i<N; i++){
    u[i].first = a[i];
    u[i].second = b[i];
  }
  sort(u.begin(), u.end());
  for(int i=0; i<N; i++){
    //cout << u[i].first <<" "<< u[i].second << endl;
    if(K <= v+u[i].second){
      cout << u[i].first << endl;
      break;
    }
    v += u[i].second;
  }
}


Measured memory_bytes: 3328
import java.awt.*;
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        Point[] ab = new Point[n];
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            ab[i] = new Point(b, a);
        }
        Arrays.sort(ab, Comparator.comparingInt(a -> a.y));
        PriorityQueue<Point> queue = new PriorityQueue<>(Comparator.comparingInt(a -> -a.x));
        long ans = 0;
        for (int i = 1, j = 0; i <= m; i++) {
            while (j < n && ab[j].y <= i) {
                queue.add(ab[j++]);
            }
            if (!queue.isEmpty()) {
                ans += queue.poll().x;
            }
        }
        System.out.println(ans);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 45460
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).ok();
    let n: usize = input.trim().parse().unwrap();

    let mut input = String::new();
    io::stdin().read_line(&mut input).ok();
    let mut v: Vec<isize> = Vec::new();
    for z in input.trim().split_whitespace() {
        v.push(z.parse().unwrap());
    }

    let mut cn = 0;

    for z in 0..n - 2 {
        if (v[z] < v[z + 1] && v[z + 1] < v[z + 2]) || (v[z] > v[z + 1] && v[z + 1] > v[z + 2]) {
            cn += 1;
        }
    }

    println!("{}", cn);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



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


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	string s, t;
	cin>>s>>t;
	int ct = 0;
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i]!=t[i]) ct++;
	}
	p(ct);
	return 0;
}

Measured memory_bytes: 3804
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if(b==c){
      System.out.println(a);
    }else if(c==a){
      System.out.println(b);
    }else if(a==b){
      System.out.println(c);
    }
  }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

const int maxn = 2020;
vector<int> g[maxn];
bool used[maxn];
int n;

void dfs(int v, int d, int p = -1) {
    if (used[v]) {
        return;
    }
    if (d == -1) {
        return;
    }
    used[v] = true;
    for (int u : g[v]) {
        if (u == p) {
            continue;
        }
        dfs(u, d - 1, p);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;

    int k;
    cin >> n >> k;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans = 0;
    if (k & 1) {
        for (int v = 0; v < n; v++) {
            for (int u : g[v]) {
                int res = 0;
                memset(used, 0, sizeof(used));
                dfs(v, k / 2, u);
                dfs(u, k / 2, v);
                for (int j = 0; j < n; j++) {
                    if (used[j]) {
                        res++;
                    }
                }
                ans = max(ans, res);
            }     
        }
    } else {
        for (int i = 0; i < n; i++) {
            memset(used, 0, sizeof(used));
            dfs(i, k / 2);
            int res = 0;
            for (int j = 0; j < n; j++) {
                if (used[j]) {
                    res++;
                }
            }
            ans = max(ans, res);
        }
    }

    cout << n - ans << '\n';

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    double r; cin >> r;
    double num =r*3.1415926*2;
    cout << fixed << setprecision(10) << num << endl;
}



Measured memory_bytes: 3784
#include <stdio.h>

int main(void) {
	int n, a[200000], hakai = 0, num = 1;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (a[i] != num)
			hakai++;
		else
			num++;
	}

	if (num == 1)
		hakai = -1;

	printf("%d", hakai);

	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s;
cin>>s;
reverse(s.begin(),s.end());
int m=s.size();
vector<int>cnt(2019);
long long ans=0;
int x=1;
int tot=0;

for(int i=0;i<m;i++)
{
cnt[tot]++;
tot+=(s[i]-'0')*x;
tot%=2019;
ans+=cnt[tot];
x=x*10%2019;

}

cout <<ans;
}

Measured memory_bytes: 3760
package main

import "fmt"

func main(){
	var N int;
	fmt.Scan(&N);

	d := make([]int, N);
	var ans int;

	for i := 0 ; i < N ; i++{
		fmt.Scan(&d[i]);
	}
	for i := 0 ; i < N-1 ; i++{
		for j := i+1 ; j < N ; j++ {
			ans += d[i] * d[j];		
		}
	}
	fmt.Println(ans);
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        long[] aList = new long[n + 1];
        long[] bList = new long[m + 1];
        for (int i = 1; i <= n; i++) {
            aList[i] = aList[i - 1] + sc.nextInt();
        }
        for (int i = 1; i <= m; i++) {
            bList[i] = bList[i - 1] + sc.nextInt();
        }
        sc.close();

        int max = 0;
        for (int i = 0, j = m; i <= n; i++) {
            while (j >= 0 && k < aList[i] + bList[j]) {
                j--;
            }
            if (j < 0) {
                break;
            }
            max = Math.max(max, i + j);
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 63204
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

string s;

int main(){
  cin >> s;
  rep(i,1,sz(s)) if(s[i] == s[i - 1]) {
    cout << i << " " << i + 1 << endl;
    return 0;
  }
  rep(i,2,sz(s)) if(s[i] == s[i - 2]) {
    cout << i - 1 << " " << i + 1 << endl;
    return 0;
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}


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

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

#define dump(x) cerr << #x << " = " <<(x)<<endl;
#define debug(x) cerr << #x << " = " <<(x) << "(L" << __LINE__ << ")" << __FILE__ << endl;

#define BIT_ON(x,b) ((x)|=(b))
#define BIT_OFF(x,b) ((x)&=~(b))
#define BIT_IS_ON(x,b) (((x)&(b))==(b))


using namespace std;

int main(void){
  int a,b,c,d;
  cin >>a >>b>>c>>d;
  if(abs(c-a) <= d) {cout << "Yes" << endl; return 0;}
  if(abs(c - b) <= d && abs(b-a) <=d) {cout << "Yes" << endl; return 0;}
  cout << "No" << endl; 
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
int main(){
  int n,q;
  int a,count=0;
  vi s;
  cin >> n;
  REP(i,n) cin>>a,s.pb(a);
  cin >> q;
  REP(i,q){
    cin>>a;
    if(binary_search(ALL(s),a)) count++;
  }
  cout << count << endl;
}



Measured memory_bytes: 3420
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int A = scn.nextInt();
		int B = scn.nextInt();
		int C = scn.nextInt();
		int Max = Math.max(A, Math.max(B, C));
		System.out.println(Max * 10 + A+B+C-Max);
		scn.close();
	}
}


Measured memory_bytes: 22228
import math
n = int(input())
m = int(math.sqrt(n))
if n == m ** 2:
    m -= 1

ans = 0
for i in range(1, m + 1):
    t = int((n - 1) / i)
    ans += (t- i + 1) * 2
    if n != i ** 2:
        ans -= 1 
print(ans)

Measured memory_bytes: 9128
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> void chmin(T &t, const T &f) { if (t > f) t = f; }
template <class T> void chmax(T &t, const T &f) { if (t < f) t = f; }

constexpr int LIM = 190;
constexpr int L = 16;

int H, W;
char A[LIM][LIM];

int sum[LIM][LIM];
int dp[L + 1][LIM][LIM][LIM];

int main() {
  for (; ~scanf("%d%d", &H, &W); ) {
    for (int x = 0; x < H; ++x) {
      scanf("%s", A[x]);
    }
    
    for (int x = 0; x < H; ++x) for (int y = 0; y < W; ++y) {
      sum[x + 1][y + 1] = sum[x + 1][y] + sum[x][y + 1] - sum[x][y] + ((A[x][y] == '#') ? 1 : 0);
    }
    for (int x = 0; x <= H; ++x) {
      for (int ya = 0; ya <= W; ++ya) {
        for (int yb = ya + 1; yb <= W; ++yb) {
          int lo = x, hi = H + 1;
          for (; lo + 1 < hi; ) {
            const int mid = (lo + hi) / 2;
            const int black = sum[x][ya] - sum[mid][ya] - sum[x][yb] + sum[mid][yb];
            const bool unicolor = (black == 0 || black == (mid - x) * (yb - ya));
            (unicolor ? lo : hi) = mid;
          }
          dp[0][x][ya][yb] = lo;
        }
      }
    }
    
    for (int t = 1; t <= L; ++t) {
      for (int x = 0; x <= H; ++x) {
        for (int ya = 0; ya <= W; ++ya) {
          for (int yb = ya + 1; yb <= W; ++yb) {
            int &d = dp[t][x][ya][yb];
            d = dp[t - 1][ dp[t - 1][x][ya][yb] ][ya][yb];
            for (int y = ya + 1; y < yb; ++y) {
              const int e = dp[t - 1][x][ya][y];
              if (d >= e) {
                break;
              }
              chmax(d, min(e, dp[t - 1][x][y][yb]));
            }
          }
        }
      }
    }
    
    int ans = L;
    for (int t = 0; t <= L; ++t) {
      if (dp[t][0][0][W] >= H) {
        chmin(ans, t);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 455296
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define EACH( it, c ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Team
{
	int id, u, a, p;

	bool operator < ( const Team &b ) const
	{
		if ( a == b.a )
		{
			if ( p == b.p )
			{
				return id < b.id;
			}
			else
			{
				return p < b.p;
			}
		}
		else
		{
			return a > b.a;
		}
	}
};

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

	while ( true )
	{
		int n;
		cin >> n;

		if ( !n )
		{
			break;
		}

		vector< Team > teams( n );
		FOR( t, teams )
		{
			cin >> t.id >> t.u >> t.a >> t.p;
		}
		sort( ALL( teams ) );

		int total = 0;
		VI res;
		map<int,int> count;

		FOR( t, teams )
		{
			if ( total < 10 && count[ t.u ] < 3 ||
				 10 <= total && total < 20 && count[ t.u ] < 2 ||
				 20 <= total && total < 26 && count[ t.u ] < 1 )
			{
				res.PB( t.id );
				count[ t.u ]++;
				total++;
			}
		}

		FOR( r, res )
		{
			cout << r << endl;
		}
	}

	return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;

  int m[N];
  for (int i = 0; i < N; i++) {
    cin >> m[i];
    X -= m[i];
  }
  sort(m, m + N);

  int answer = N;
  while (X - m[0] >= 0) {
    answer++;
    X -= m[0];
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
// ＡＢＣの過去問を解くだけだよ
// フォント x:小文字 X:大文字

#include <bits/stdc++.h>

using namespace std;

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

    if (a + b >= c)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)

using namespace std;

struct data_t {
    string str;
    int num;
    int index;
} ;

int main() {
    int n;
    cin >> n;
    vector<data_t> res(n);
    rep(i, n){
        cin >> res.at(i).str >>  res.at(i).num ;
        res.at(i).index = i+1;
    }
    sort(res.begin(), res.end(), [](const data_t &a, const data_t&b){
        return (a.str == b.str) ? (a.num > b.num ) : (a.str < b.str);  
    });                         //a.numがb.numより大きくなるように.   a.strがb.strより小さくなるように

    for_each(res.begin(), res.end(), [](const data_t &a){
       cout << a.index << endl;
    });
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14 100兆
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  string N;
  cin >> N;
  if(N.at(0) == '7'){
    cout << "Yes" << endl;
  }
  else if(N.at(1) == '7'){
    cout << "Yes" << endl;
  }
  else if(N.at(2) == '7'){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool ocur[120];
int main(){
  int x, n;
  cin>>x>>n;
  for(int i=0; i<n; i++){
    int a;
    cin>>a;
    ocur[a]=true;
  }
  for(int i=0; ; i++){
      if(x-i>=0 && !ocur[x-i]){
          cout<<x-i;
          return 0;
      }
      else if(!ocur[x+i]){
          cout<<x+i;
          return 0;
      }
  }
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int n[3];
    int f = 0, s = 0;
    for (int i = 0; i < 3; ++i) {
        cin >> n[i];
        if (n[i] == 5) ++f;
        else if (n[i] == 7) ++s;
    }
    if (f == 2 && s == 1) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include<stack>
#include <unordered_map>

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
int abs(int a) { return a < 0 ? -a : a; }

using namespace std;

int main() {
	string S;
	cin >> S;
	if (S.find("KIH") == string::npos) {
		cout << "NO";
		return 0;
	}
	int count = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A') {
			S.erase(S.begin() + i);
			count++;
			if (count >= 2) {
				cout << "NO";
				return 0;
			}
          	i--;
		}
		else {
			count = 0;
		}
	}
	if (S == "KIHBR")
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


Measured memory_bytes: 256
import re

while True:
    try:
        s = input().strip()
    except:
        break
    var = list(re.split('[+=]', s))
    ans = -1
    for i in range(10):
        num = []
        ok = True
        for v in var:
            if i==0 and len(v)>=2 and v[0]=='X':
                ok = False
                break
            x = 0
            for j in range(len(v)):
                if v[j] == 'X':
                    x = x*10 + i
                else:
                    x = x*10 + ord(v[j])-ord('0')
            num.append(x)
        if ok:
            if num[0]+num[1] == num[2]:
                ans = i
                break
    if ans >= 0:
        print(ans)
    else:
        print('NA')


Measured memory_bytes: 6512
import java.util.Scanner;

/**
 *
 * @author C0117177
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a <= 9 && b<= 9){
            System.out.println(a * b);
        }else{
            System.out.println(-1);
        }
        sc.close();  
    }  
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N;
    string S;
    cin >> N >> S;
    vector<ll> E(N + 1), W(N + 1);
    for(ll i = 0; i < N; i++){
        E[i + 1] = E[i] + (S[i] == 'E');
        W[i + 1] = W[i] + (S[i] == 'W');
    }
    ll ans = 5e15;
    for(ll i = 0; i < N; i++){
        ll tmp = 0;
        tmp += W[i];
        tmp += E[N] - E[i + 1];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5380
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 998244353;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N,S;
    cin >> N >> S;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> coef(S+5,0);

    ll ans = 0;

    rep(i,N){
        vector<ll> now(S+5);
        ++now[0];
        if(A[i] <= S) ++now[A[i]];
        rep(j, S+5){
            now[j] += coef[j];
            if(j + A[i] <= S) now[j+A[i]] += coef[j];

            now[j] %= MOD;
        }
        coef = now;

        ans += coef[S], ans %= MOD;
    }


    print(ans);

    return 0;
}

Measured memory_bytes: 384
N = $stdin.read.split(/\s/).map(&:to_i)[0]
counts = Array.new(N) { 0 }
1.upto(N) {|x|
  x2 = x * x
  break if N < x2 + 5
  1.upto(N) {|y|
    y2 = y * y
    xy = x * y
    break if N < x2 + y2 + xy + 3
    1.upto(N) {|z|
      n = x * x + y * y + z * z + x * y + y * z + z * x
      if n <= N
        counts[n - 1] += 1
      end
      break if N <= n
    }
  }
}
 
puts counts.join("\n")


Measured memory_bytes: 14324
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

vector<bool> seen;
vector<i64> x;
vector<vector<pair<int,int>>> g;
const i64 INF = 1<<61;

bool dfs(int v, int d)
{
    if(seen[v]) return true;
    seen[v] = true;

    for(auto& gi:g[v])
    {
        int nv = gi.first;
        int nd = d + gi.second;

        if(x[nv]==-INF)
            x[nv] = nd;
        else if(x[nv]!=nd)
            return false;
        
        if(!dfs(nv,nd)) return false;
    }

    return true;
}

int main()
{   
    int n,m;
    cin >> n >> m;
    g.resize(n);
    rep(i,m)
    {
        int l,r,d;
        cin >> l >> r >> d;
        g[r-1].push_back({l-1,d});
        g[l-1].push_back({r-1,-d});
    } 

    seen.assign(n,false);  
    x.assign(n,-INF);
    
    rep(i,n)
    {
        if(seen[i]) continue;
        if(g[i].empty()) continue;

        if(!dfs(i,0))
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 11392