akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll c(ll a,ll b)
{
  if(a==0)return b==0?1:0;

if(b>a)return 0;

  ll val=1;
ll fac=1;
for(int i=1;i<=b;i++)fac*=i;
for(int i=a;i>=a-b+1;i--)val*=i;

  return val/fac;

}

ll pop_count(ll n)
{
  ll cnt=0;
  while(n)
  {
    if(n&1)cnt++;
    n>>=1;
  }
  return cnt;
}

ll ini(ll n)
{
  ll pos=0,ans=70;
  while(n)
  {
    if(n&1)
    {
      return pos;
    }
    pos++;
    n>>=1;
  }
  return pos;
}

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

string s;cin>>s;
ll cnt=0,ans=0;

for(char x:s)
{
  if(x=='B')cnt++;
  else ans+=cnt;
}

cout<<ans<<"\n";

return 0;

}


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

#define rep(i,j) for(int (i)=0;(i)<(j);++(i))

int main() {
    int m;
    cin >> m;
    while (m--) {
        int ini, y, n, ans = -1;
        cin >> ini >> y >> n;
        rep(i, n) {
            int f, com;
            double rate;
            cin >> f >> rate >> com;
            int tini = ini;
            int tnri = 0;
            rep(j, y) {
                int t = tini*rate;
                if (f) tini = tini+t-com;
                else {
                    tini -= com;
                    tnri += t;
                }
            }
            tini += tnri;
            ans = max(tini, ans);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3136
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MAX 100

void initialize(void);
int isEmpty(void);
int isFull(void);
int push(int);
int pop(void);

int top;
int m[MAX];

int main(){
  int x, a, b;
  char s[100];

  while( scanf("%s", s) != EOF ){

    if ( s[0] == '+' ){
      a = pop();  
      b = pop();
      push(a+b);

    } else if ( s[0] == '-' ){
      a = pop();
      b = pop();
      push(b-a);

    } else if ( s[0] == '*' ){
      a = pop();
      b = pop();
      push(a*b);

    } else {
      x = atoi(s);
      push(x);
    }
  }

  printf("%d\n",m[top]);

  return 0;
}

int isEmpty(void){
  if (top == 0) return 1;
  else return 0;
}

int isFull(void){
  if(top > MAX-1) return 1;
  else return 0;
}

int push(int x){
  if(isFull() == 0){
  top++;
  m[top] = x;
  }
}

int pop(void){
  if (isEmpty() == 0){
    top--;
  return m[top + 1];
  }
}

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

public class Main {
    public static void main(String[] args) {

        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String str = String.valueOf(in.readLine());
            String[] arr = str.split(" ", 0);
            int N = Integer.parseInt(arr[0]);
            int A = Integer.parseInt(arr[1]);
            int B = Integer.parseInt(arr[2]);
            int max = 0;
            int min = 0;
            int large = 0;
            int small = 0;
            int diff = 0;
            
            if (N < A || N < B) {
                System.out.println("Error");
                System.exit(0);
            }
            
            if (A > B) {
                max = B;
                large = A;
                small = B;
            } else {
                max = A;
                large = B;
                small = A;
            }
            
            diff = N - large;
            if (diff < small) {
                min = small - diff;
            } else {
                min = 0;
            }
            System.out.println(max + " " + min);
        } catch(Exception e) {
            System.out.println(e);
            System.exit(0);
        } 
    }
}

Measured memory_bytes: 22228
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int ANS = 0;
	int N ;//

 
	//Nをスキャン
	scanf("%d", &N);
	//N個の数字をスキャン 0からN-1まで
	ANS=N*N*N;
 

 
	printf("%d", ANS);
 
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)


int main(){
   int n;
  cin >>n;
   ll sum=0;
  for(int i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0){
      sum+=i;
    }
  }
  cout << sum << endl;
      
    
}
  

Measured memory_bytes: 3620
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll n;
    cin>>n;
    ll ans = 0;
    if(n>=400)ans=8;
    if(n>=600)ans=7;
    if(n>=800)ans=6;
    if(n>=1000)ans=5;
    if(n>=1200)ans=4;
    if(n>=1400)ans=3;
    if(n>=1600)ans=2;
    if(n>=1800)ans=1;
    out(ans);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    solve();
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k,i,c1;
    scanf("%d%d%d%d",&a,&b,&c,&k);
    c1=0;
    while(b<=a){
        b*=2;
        c1++;
    }
    while(c<=b){
        c*=2;
        c1++;
    }
    if(c1<=k)
      printf("Yes\n");
    else
      printf("No\n");
    return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <stack>
using namespace std;
int main(){
  string s;
  cin >> s;
  stack<char> t;
  for(int i=0;i<s.size();i++){
    if(s[i] == 'B'){
      if(!t.empty()){
        t.pop();
      }
    }else{
      t.push(s[i]);
    }
  }

  stack<char> ans;
  while(!t.empty()){
    ans.push(t.top());
    t.pop();
  }

  while(!ans.empty()){
    cout << ans.top();
    ans.pop();
  }

  cout << endl;
}


Measured memory_bytes: 256
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);
function main(){
  var n = o.a();
  var m = o.a();
  return n === m ? "Yes" : "No";
}

Measured memory_bytes: 21956
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    string s;cin>>s;
    ll res=0;
    priority_queue<ll> que;
    rep(i,n){
        if(s[i]=='R'){
            que.push(i);
        }
    }
    if(que.size()==0){
        cout<<0<<endl;
        return 0;
    }
    rep(i,n){
        if(s[i]=='W'){
            ll x=que.top();que.pop();
            if(x<=i)break;
            s[x]='W';
            s[i]='R';res++;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 5396
class Segment_Tree:
    def __init__(self,n,func,init):
        self.n = n
        self.tree = [init]*(2*self.n - 1)
        self.func = func
        self.init = init

    def update(self,i,x):
        i += self.n - 1
        self.tree[i] = x
        while i>0:
            i = int((i-1)/2)
            self.tree[i] = self.func((self.tree[2*i+1], self.tree[2*i+2]))

    def find(self,a,b,k,l,r):
        if r <= a or b <= l:
            return self.init
        if a <= l and r <= b:
            return self.tree[k]
        vl = self.find(a,b,k*2+1,l,int((l+r)/2))
        vr = self.find(a,b,k*2+2,int((l+r)/2),r)
        return self.func((vl, vr))

n, q = map(int, input().split())
N = 1
while N < n:
    N *= 2

func = lambda a: a[0]+a[1]

segtre = Segment_Tree(N,func,0)

for _ in range(q):
    com, x, y = map(int, input().split())
    if com == 0: #add
        segtre.update(x-1,segtre.tree[x + segtre.n - 2]+y)
    else: #getSum
        print(segtre.find(x-1,y,0,0,N))



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

int main() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  rep(i,n) cin >> a[i];
  sort(a.rbegin(), a.rend());

  int64_t res = 0;
  for (int i = 1; i < n; ++i) res += a[i/2];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 4840
#!/usr/bin/env python
# coding: utf-8

# In[49]:


#import numpy as np
N = int(input())
S = input()
"""
5
ababa
2

13
strangeorange
5
"""


# In[54]:


i = 0
j = 1
max_cont = 0

while j < N:
    if S[i:j] in S[j:]:
        max_cont = max(max_cont, len(S[i:j]))
        j += 1
    else:
        i += 1
    if i == j:
        i += 1
        j += 2


# In[55]:


print(max_cont)


# In[ ]:






Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

struct UnionFind {
        int n;
        vector<int> parent;
        vector<int> rank;
        vector<int> num;
        int find(int x) {
                if (parent[x] == x) return  x;
                return parent[x] = find(parent[x]);
        }
        UnionFind(int n_) {
                n = n_;
                parent.resize(n);
                for (int i = 0; i < n; i ++) parent[i] = i;
                rank.assign(n, 0);
                num.assign(n, 1);
        }
        void unite(int x, int y) {
                if ((x = find(x)) != (y = find(y))) {
                        if (rank[x] < rank[y]) {
                                parent[x] = y;
                                num[y] += num[x];
                        } else {
                                parent[y] = x;
                                if (rank[x] == rank[y]) rank[x] ++;
                                num[x] += num[y];
                        }
                        n --;
                }
        }
        bool same(int x, int y) { return find(x) == find(y); }
        int get() { return n; }
        int get(int x) { return num[find(x)]; }
};

int main() {
        int w, h;
        while (scanf("%d%d", &w, &h), w) {
                vector<vector<int>> s(h, vector<int> (w));
                int lands = 0;
                map<pair<int, int>, int> ptol;
                for (int i = 0; i < h; i ++) {
                        for (int j = 0; j < w; j ++){
                                scanf("%d", &s[i][j]);
                                if (s[i][j]) {
                                        ptol[make_pair(i, j)] = lands;
                                        lands ++;
                                }
                        }
                }
                UnionFind uf(lands);
                for (int i = 0; i < h; i ++) {
                        for (int j = 0; j < w; j ++) {
                                if (s[i][j]) {
                                        if (i - 1 >= 0 && j + 1 < w && s[i - 1][j + 1]) uf.unite(ptol[make_pair(i, j)], ptol[make_pair(i - 1, j + 1)]);
                                        if (j + 1 < w && s[i][j + 1]) uf.unite(ptol[make_pair(i, j)], ptol[make_pair(i, j + 1)]);
                                        if (i + 1 < h && j + 1 < w && s[i + 1][j + 1]) uf.unite(ptol[make_pair(i, j)], ptol[make_pair(i + 1, j + 1)]);
                                        if (i + 1 < h && s[i + 1][j]) uf.unite(ptol[make_pair(i, j)], ptol[make_pair(i + 1, j)]);
                                }
                        }
                }
                printf("%d\n", uf.get());
        }
        return 0;
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int32_t main()
{
    IOS
    int k,a,b;
    cin>>k>>a>>b;
    for (int i=a;i<=b;i++)
        if (i%k==0) return cout<<"OK"<<endl,0;
    cout<<"NG"<<endl;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	std::string s; cin >> s;
	
	for(int i = 0; i <= s.size(); i++) {
		for(int j = i; j < s.size(); j++) {
			std::string t = s.substr(0, i) + s.substr(j, s.size() - j);
			if(t == "keyence") {
				printf("YES\n");
				return 0;
			}
		}
	}
	printf("NO\n");
	return 0;
}


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

int main() {
  string S[50], T[50];
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    cin >> S[i];
  for (int i = 0; i < m; i++)
    cin >> T[i];
  for (int i = 0; i <= n - m; i++) {
    for (int j = 0; j <= n - m; j++) {
      bool OK = true;
      for (int k = i; k < i + m; k++) {
        if (T[k - i] != S[k].substr(j, m))
          OK = false;
      }
      if (OK == true) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#ifdef XENON
#include <debug.h>
#endif

#define F first
#define S second
#define endl "\n"
#define eb emplace_back
#define fastio() ios_base:: \
  sync_with_stdio(false); \
  cin.tie(NULL)

using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using pii = pair<int,int>;

const int N = 2e5+5;
const ll INF = 1e18+1;
const int MOD = 1e9+7;

int main()
{
  fastio();
  int k;cin >> k;
  string s;cin >> s;

  if (s.size() <= k)
    cout << s;
  else
  {
    for (int i = 0; i < k; i++)
      cout << s[i];
    cout << "...";
  }
  return 0;
}


Measured memory_bytes: 3124
#include<iostream>
using namespace std;
const int N=2e5+10;
long long a[N],b[N];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[a[i]]++;
	}
	long long sum=0;
	for(int i=0;i<=n;i++) sum+=(b[i]*(b[i]-1))/2;
	for(int i=0;i<n;i++){
		long long res=sum-b[a[i]]*(b[a[i]]-1)/2+(b[a[i]]-1)*(b[a[i]]-2)/2;
		cout<<res<<"\n";
	}
	return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<queue>
#define ll long long
#define inf INT_MAX
ll int max2=0;
ll int dp[200000];
void dfs(vector<ll int>graph[],ll int i,ll int visited[],ll int maxi)
{
    visited[i]=1;
for(int j=0;j<graph[i].size();j++)
{
	//cout<<maxi<<endl;
    if(visited[graph[i][j]]==0)
	{
	//	cout<<graph[i][j]<<endl;
	dfs(graph,graph[i][j],visited,maxi+1);	
	}
	dp[i]=max(dp[i],1+dp[graph[i][j]]);	
}
//cout<<maxi<<endl;
if(max2<=dp[i])
max2=dp[i];
//visited[i]=0;
}
main()
{
ll int m,n;
cin>>n>>m;
vector<ll int>graph[n+1];
ll int visited[n+1];
memset(visited,0,sizeof(visited));
for(int i=0;i<m;i++) 
{
	ll int p,q;
	cin>>p>>q;
	graph[p].push_back(q);	
}
memset(dp,0,sizeof(dp));
for(int i=1;i<=n;i++)
{   // int maxi=0;
     if(visited[i]==0)
	dfs(graph,i,visited,0);
//	visited[i]=0;
//	cout<<max2<<endl;
}
cout<<max2<<endl;
}


Measured memory_bytes: 11520
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

//UF Tree

struct UnionFind{

    //親番号の配列。自身が親なら木の頂点数*(-1)

    vector<int> r;

    //最初はバラバラなので全部親として初期化

    UnionFind(int N){
        r = vector<int>(N, -1);
    }

    //xの親を根にする関数

    int root(int x){
        if(r[x] < 0)return x;
        return r[x] = root(r[x]);
    }

    //二つの子を同じ根に結び付ける関数

    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;
        if(r[x] > r[y])swap(x,y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    //木の枝の数

    int size(int x){
        return -r[root(x)];
    }

    //同グループかの判定

    bool same(int x, int y){
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    vector<int> p(N);

    for(int i = 0; i < N; i++){
        cin >> p[i];
        p[i] -- ;
    }

    UnionFind UF(N); //集合の生成,インスタンス化
    for(int i = 0; i < M; i++){
        int A,B;
        cin >> A >> B;
        A--; B--;

        UF.unite(A,B);
    }

    //i番目の要素がiのあるグループにあればよい
    int ans = 0;

    for(int i = 0; i < N; i++){
        if(UF.same(p[i],i))ans++;
    }

    cout << ans << endl;



}

Measured memory_bytes: 3960
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

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

  int i,sum=0; 
  int a[n];
  for(i=0;i<n;i++){
    cin >> a[i];
    sum = sum + a[i]; 
  }

  if(sum >= h){
    std::cout << "Yes";
  }else{
    std::cout << "No";
  }

}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
  long long n;cin>>n;
  if( n%2==0 or n%5==0)
    cout<<"-1\n";
  else{
    long long f(0),a(7);
    while(true){
      a%=n;
      f++;
      if(a==0){
        cout<<f<<endl;break;
      }
      a*=10;
      a+=7;
    }
  }
  return 0;
}


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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

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

	int n;
	cin >> n;

	bool ok = false;
	for (int i = 1; i * i <= n; ++i)
		if (n % i == 0 && i < 10 && n / i < 10)
			ok = true;
	cout << (ok ? "Yes\n" : "No\n");
}


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

using namespace std;
using ll = long long;

using Graph = vector<vector<int>>;

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

  int n, q;
  cin >> n >> q;
  Graph g(n);
  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);
  }
  vector<ll> counter(n);
  for (int i = 0; i < q; i++) {
    int p, x;
    cin >> p >> x;
    p--;
    counter[p] += x;
  }

  vector<bool> visit(n, false);
  vector<ll> ans(n);
  function<void(int, ll)> dfs = [&](int cur, ll cnt) {
    visit[cur] = true;
    ans[cur] = cnt;
    for (auto e : g[cur]) {
      if (visit[e])
        continue;
      dfs(e, cnt + counter[e]);
    }
  };

  dfs(0, counter[0]);
  for (auto a : ans)
    cout << a << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 32872
#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define N 200010

int main() {
	int n, a[N], b[N] = { 0 }, c[N] = { 0 }; long long k;
	scanf("%d %lld", &n, &k);
	Rep(i, 1, n + 1)scanf("%d", &a[i]);
	int ch = 1, start, end;
	Rep(i, 1, N+10) {
		if (b[ch]!=0){ start = b[ch]; end = i; break; }
		b[ch] += i;
		ch = a[ch];
    }
	c[0]=ch;
	Rep(i,1,end-start+1) {
		c[i] = a[ch];
		ch = a[ch];
	}
	if (k<=start) {
		ch=1;
		rep(i,k) {
			ch = a[ch];
		}
		printf("%d",ch);
	}
	else if(end-start==1)printf("%d", ch);
	else{
		k++;
		k = k-start;
		k = k%(end-start);
		printf("%d",c[k]);
	}
}


Measured memory_bytes: 4036
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

using namespace std;

const int N = 100010;

struct Point{
	int x, y, id;
}P[N];

inline bool cmpa(const Point& A, const Point& B){
	return A.x + A.y != B.x + B.y ? A.x + A.y < B.x + B.y : A.x < B.x;
}

inline bool cmpb(const Point& A, const Point& B){
	return A.x - A.y != B.x - B.y ? A.x - A.y < B.x - B.y : A.x < B.x;
}

int n, a, b, d;
int deg[N], fa[N];

int find(int x){
	return x == fa[x] ? x : (fa[x] = find(fa[x]));
}

inline void Union(int u, int v){
	u = P[u].id, v = P[v].id;
	if(find(u) ^ find(v)) fa[find(u)] = find(v);
}

int main(){
	scanf("%d%d%d", &n, &a, &b);
	For(i, 1, n) scanf("%d%d", &P[i].x, &P[i].y), P[i].id = i, fa[i] = i;
	d = abs(P[a].x - P[b].x) + abs(P[a].y - P[b].y);
	
	sort(P + 1, P + n + 1, cmpa);
	int r = 1;
	For(i, 1, n){
		//printf("(%d, %d)\n", P[i].x, P[i].y);
		while(r <= n && (P[r].x + P[r].y < P[i].x + P[i].y + d || 
					(P[r].x + P[r].y == P[i].x + P[i].y + d && P[r].x < P[i].x))) ++r;
		int l = r;
		while(r < n && P[r + 1].x + P[r + 1].y == P[i].x + P[i].y + d && P[r + 1].x <= P[i].x + d) ++r;
		
		if(P[l].x + P[l].y == P[i].x + P[i].y + d && P[l].x <= P[i].x + d){
			deg[P[i].id] += r - int(lower_bound(P + 1, P + n + 1, (Point){P[i].x, P[i].y + d, 0}, cmpa) - P) + 1;
		//	printf("%d %d %d %d\n", P[i].id, deg[P[i].id], l, r);
			For(j, l, r) Union(i, j);
		}
	}

	sort(P + 1, P + n + 1, cmpb);
	r = 1;
	For(i, 1, n){
		//printf("(%d, %d)\n", P[i].x, P[i].y);
		while(r <= n && (P[r].x - P[r].y < P[i].x - P[i].y + d || 
					(P[r].x - P[r].y == P[i].x - P[i].y + d && P[r].x <= P[i].x))) ++r;
		int l = r;
		while(r < n && P[r + 1].x - P[r + 1].y == P[i].x - P[i].y + d && P[r + 1].x < P[i].x + d) ++r;
		
		if(P[l].x - P[l].y == P[i].x - P[i].y + d && P[l].x < P[i].x + d){
			deg[P[i].id] += r - int(upper_bound(P + 1, P + n + 1, (Point){P[i].x, P[i].y - d, 0}, cmpb) - P) + 1;
		//	printf("%d %d %d %d\n", P[i].id, deg[P[i].id], l, r);
			For(j, l, r) Union(i, j);
		}
	}

	long long ans = 0;
	For(i, 1, n) if(find(a) == find(i)) ans += deg[i];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>

int main(void) {
	int kanzya_num;
	int max_id,max_dist;
	int now_id,now_dist1,now_dist2;
	int i;
	while(1) {
		scanf("%d",&kanzya_num);
		if(kanzya_num==0)break;
		max_id=0;max_dist=0;
		for(i=0;i<kanzya_num;i++) {
			scanf("%d%d%d",&now_id,&now_dist1,&now_dist2);
			if(max_dist<now_dist1+now_dist2) {
				max_dist=now_dist1+now_dist2;
				max_id=now_id;
			}
		}
		printf("%d %d\n",max_id,max_dist);
	}
	return 0;
}

Measured memory_bytes: 412
#include <iostream>
#include <set>
#include <map>
#include <queue>

using namespace std;

map<unsigned int,int> dist;

unsigned int change( unsigned short stage[4][2] )
{
	return stage[0][0] + stage[1][0] * 10 + stage[2][0] * 100 + stage[3][0] * 1000 + stage[0][1] * 10000 + stage[1][1] * 100000 + stage[2][1] * 1000000 + stage[3][1] * 10000000;
}

void reverse_change( unsigned short stage[4][2], int data )
{
	stage[3][1] = data / 10000000;
	data -= stage[3][1] * 10000000;
	stage[2][1] = data / 1000000;
	data -= stage[2][1] * 1000000;
	stage[1][1] = data / 100000;
	data -= stage[1][1] * 100000;
	stage[0][1] = data / 10000;
	data -= stage[0][1] * 10000;
	stage[3][0] = data / 1000;
	data -= stage[3][0] * 1000;
	stage[2][0] = data / 100;
	data -= stage[2][0] * 100;
	stage[1][0] = data / 10;
	data -= stage[1][0] * 10;
	stage[0][0] = data;
	data -= stage[0][0];
}

bool move( unsigned short target[4][2], unsigned int u, int b )
{
	unsigned short stage[4][2];
	int x,y;


	reverse_change( stage, u );
	for( int i = 0;i < 2;i++ ){
		for( int j = 0;j < 4;j++ ){
			if( stage[j][i] == 0 ){
				x = j;
				y = i;
				goto A;
			}
		}
	}
A:
	int dx,dy;

	dx = x; dy = y;
	switch( b ){
		case 0:
			dx++;
			if( dx > 3 ) return true;
			break;
		case 1:
			dx--;
			if( dx < 0 ) return true;
			break;
		case 2:
			dy++;
			if( dy > 1 ) return true;
			break;
		case 3:
			dy--;
			if( dy < 0 ) return true;
			break;
	}

	unsigned short a;
	a = stage[x][y];
	stage[x][y] = stage[dx][dy];
	stage[dx][dy] = a;

	for( int i = 0;i < 2;i++ ){
		for( int j = 0;j < 4;j++ ){
			target[j][i] = stage[j][i];
		}
	}

	return false;
}

			

int bfs( unsigned short stage[4][2] )
{
	set<unsigned int> history;
	queue<unsigned int> q;

	dist[ change( stage ) ] = 0;

	q.push( change( stage ) );
	while( !q.empty() ){
		unsigned int u = q.front();

		for( int i = 0;i < 4;i++ ){
			unsigned short v[4][2];
			if( move( v, u, i ) ) continue;
			unsigned int hoge = change( v );
			if( history.count( hoge ) ) continue;
			dist[ hoge ] = dist[ u ] + 1;
			history.insert( hoge );
			q.push( hoge );
		}

		q.pop();
	}
	return -1;
}


int main(int argc, char const* argv[])
{
	unsigned short stage[4][2];

	reverse_change( stage, 76543210 );
	bfs( stage );
	dist[ change( stage ) ] = 0;
	
	while( cin >> stage[0][0] >> stage[1][0] >> stage[2][0] >> stage[3][0] >> stage[0][1] >> stage[1][1] >> stage[2][1] >> stage[3][1] ){
		cout << dist[ change( stage ) ] << endl;

	}
	return 0;
}

Measured memory_bytes: 2016
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main{

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		stones(sc);
		/*
		 * String str =sc.nextLine(); int q=sc.nextInt(); while(q-->0){ int
		 * len=sc.nextInt(); int[] ch=new int[26]; boolean chk=false; for(int
		 * i=0;i<str.length()-len+1;i++){ String sub=str.substring(i, i+len);
		 * System.out.println(sub); boolean p=method(sub); if(p){ chk=true; //
		 * break; } } System.out.println(chk?len:-1);
		 */
	}

	private static void stones(FastReader sc) {
		int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
		System.out.println((Math.abs(a-c)<=d)||((Math.abs(a-b)<=d&&Math.abs(b-c)<=d))?"Yes":"No");
	}
}

Measured memory_bytes: 21204
#include<stdio.h>
#include<string.h>
#define N 1000

char T[N],P[N];

int main(){
int i,j,tlen,plen,cnt;
scanf("%s",T);
scanf("%s",P);

tlen = strlen(T);
plen = strlen(P);


for(i=0;i<tlen;i++){
cnt=0;
for(j=0;j<plen;j++)
if(T[i+j]==P[j]) cnt++;

if(cnt==plen)printf("%d\n",i);
}

return 0;
}

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

using namespace std;
typedef long long ll;
const int maxn=2e5+5;
const int INF=1e9+5;
set<int> se;
multiset<int> mse;
int dis[maxn]={0};///到第i位置的最小值
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int h,w;
    cin>>h>>w;
    for(int i=0;i<w;i++)
    {
        se.insert(i);///存目前可以到达的点 （0-w-1）
        mse.insert(0);///存到到达点的距离
    }
    for(int i=0;i<h;i++)
    {
        int l,r;
        cin>>l>>r;
        l--;
        int Min=INF;
        set<int>::iterator it=se.lower_bound(l);
        while(it!=se.end()&&*it<=r)
        {
            int x=*it;
            //cout<<x<<endl;
            Min=min(Min,dis[x]+r-x);
            it=se.erase(it);
            mse.erase(mse.find(dis[x]));
            dis[x]=INF;
        }
        if(r!=w&&Min!=INF)
        {
            dis[r]=min(Min,dis[r]);
            se.insert(r);
            mse.insert(dis[r]);
        }
        if(!mse.empty())
        {
            cout<<*mse.begin()+i+1<<"\n";
        }
        else
        {
            cout<<"-1"<<"\n";
        }

    }
    return 0;
}


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

using namespace std;
using ll = long long;

const ll mod = 7 + 1e9;

ll mpow (ll x, ll y) {
	ll a = 1;
	for (int i = 30; i >= 0; i--) {
		a = (a * a) % mod;
		if (y >> i & 1) {
			a = (a * x) % mod;
		}
	}
	return a;
}

int main() {
	ll n, k, ans = 0;
	cin >> n >> k;
	vector<ll> g(k + 1, 0);
	for (ll i = k; i > 0; i--) {
		g[i] = mpow(k / i, n);
		for (int v = 2; v * i <= k; v++) {
			g[i] -= g[v * i];
			if (g[i] < 0) g[i] += mod;
		}
		ans += g[i] * i;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4040
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

double my_abs(double a) {

    if (a < 0) return -a;
    else return a;
}

int main() {

    int n;
    scanf("%d", &n);

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    sort(a.begin(), a.end());
    printf("%d ", a[n-1]);

    int t = 0;
    int diff = abs(a[n-1] - a[0] * 2);
    for (int i = 1; i < n; i++) {
        int diff2 = abs(a[n-1] - a[i] * 2);
        if (diff > diff2) {
            diff = diff2;
            t = i;
        }
    }
    printf("%d", a[t]);

    return 0;
}


Measured memory_bytes: 640
from collections import Counter # 重複個数のカウント: Counter(num_list)

def main():
    n, k = map(int, input().split())
    num_list = list(map(int, input().split()))

    count_list = Counter(num_list)

    tmp_list = []

    for v in count_list.values():
        tmp_list.append(v)

    tmp_list.sort()
    
    count = 0
    for i in range(len(tmp_list)-k):
        count += tmp_list[i]

    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 100680
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main() {
  long long int number_n, i, min_abs_number = INT_MAX, sum = 0, counter_minus_number = 0;
  scanf("%lld", &number_n);
  long long int number_array[number_n];
  for(i = 0; i < number_n; i++) {
    scanf("%lld", &number_array[i]);
    if(number_array[i] < 0) {
      counter_minus_number++;
    }
    number_array[i] = abs(number_array[i]);
  }
  for(i = 0; i < number_n; i++) {
    if(number_array[i] < min_abs_number) {
      min_abs_number = number_array[i];
    }
    sum += number_array[i];
  }
  if(counter_minus_number % 2 == 1) {
    sum -= 2 * min_abs_number;
  }
  printf("%lld\n", sum);
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int isReverse = 1;
  string s,sr;
  cin >> s;
  sr = s;
  reverse(sr.begin(),sr.end());
  int q;
  cin >> q;
  ll n = sz(s);
  rep(i,q){
    int t;
    cin >> t;
    if(t == 1){
      if(isReverse == 1) isReverse = 2;
      else isReverse = 1;
      //reverse(s.begin(),s.end());
    }else{
      int f;
      string c;
      cin >> f >> c;
      if(f == isReverse){
        s.insert(0,c);
        sr.insert(n,c); 
      }else{
        sr.insert(0,c);
        s.insert(n,c);
      }
      n+=sz(c);
    }
  }

  if(isReverse == 2) cout<<sr<<endl;//reverse(s.begin(),s.end());
  else cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
int main(){
  int e1,e2,e3,e4;
  cin>>e1>>e2>>e3>>e4;
  if((e1 == e2 && e3 == e4)||(e1 == e3 && e2 == e4)||(e1 == e4 && e2 == e3)) cout<<"yes"<<endl;
  else cout<<"no"<<endl;  
  return 0;
}
  




Measured memory_bytes: 3100
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

a = LIST()

curr = 1000

st = 0

for i in range(1, n):
    if(a[i]>a[i-1]):
        if(curr>0):
            temp = curr//a[i-1]
            st+=temp
            curr-=temp*a[i-1]
    elif(a[i]<a[i-1]):
        if(st>0):
            curr+=st*a[i-1]
            st = 0

if(st>0):
    curr+=st*a[-1]
print(curr)

Measured memory_bytes: 68224
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int n,a;
    int mi=10000000,ma=-10000000;
    cin>>n;
    long long sum=0;
    for(int i=1;i<=n;i++){
        cin>>a;
        sum=sum+a;
        if(a<mi){
            mi=a;
        }
        if(a>=ma){
            ma=a;
        }
    }
    cout<<mi<<" "<<ma<<" "<<sum<<endl;
    return 0;
}



Measured memory_bytes: 3108
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    s = 0
    for i in range(1, N):
        pre = A[i-1] #前の人の身長
        now = A[i] #今見ている身長
        if pre > now:
            step = pre-now
            s += step
            A[i] += step
    print(s) 
if __name__ == '__main__':
    main()


Measured memory_bytes: 29376
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

int N,S;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> S;
    vector<int> a(N);
    REP(i,N) cin >> a[i];
    int r = 0, sum = 0, ans = N+1;
    REP(l,N){
        while(r < N && sum < S) sum += a[r++];
        if(sum >= S) chmin(ans,r-l);
        if(l==r) ++r;
        else sum -= a[l];
    }
    cout << (ans==N+1 ? 0 : ans) << '\n';
    return 0;
}


Measured memory_bytes: 3368
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws IOException {
        List<String> lines = readLines();
        String line = lines.get(0);
        List<Integer> numbers = Arrays.asList(line.split(" "))
                .stream()
                .map((n) -> Integer.parseInt(n))
                .collect(Collectors.toList());

        System.out.println((numbers.get(0) < numbers.get(1)) ? "0" : "10");
    }

    public static List<String> readLines() throws IOException {
        InputStream in = System.in;
        InputStreamReader reader = new InputStreamReader(in, "utf-8");
        BufferedReader br = new BufferedReader(reader);

        List<String> retList = new ArrayList<>();
        String line = br.readLine();
        while (line != null && !line.isEmpty()) {
            retList.add(line);
            line = br.readLine();
        }

        reader.close();
        br.close();
        return retList;
    }
}

Measured memory_bytes: 25940
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = null;
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			String input = br.readLine();
			String[] inputs = input.split(" ");
			int n = Integer.parseInt(inputs[0]);
			int a = Integer.parseInt(inputs[1]);
			int b = Integer.parseInt(inputs[2]);

			int na = n * a;
			if (na <= b) {
				System.out.println(na);
			} else {
				System.out.println(b);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if(br != null) {
					br.close();
					br = null;
				}
			} catch (Exception e) {

			}
		}
	}
}


Measured memory_bytes: 21204
import java.util.*;
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(A==B && B==C){
       	System.out.println("No");
       }else{
         if(A!=B && B!= C && C!=A){
         System.out.println("No");
         }else{
         System.out.println("Yes");
         }
       }
    }
		
    }

Measured memory_bytes: 21716
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  int x=0;
  int y=0;
  int z=0;
  int w=0;
  int ans1=100*A;
  int ans2=0;

  while(100*A*x<F){
    y=0;
    z=0;
    w=0;
    while(100*(A*x+B*y)<F){
      z=0;
      w=0;
      while(100*(A*x+B*y)+C*z<=F and C*z<=(A*x+B*y)*E){
        w=0;
        while(100*(A*x+B*y)+(C*z+D*w)<=F and (C*z+D*w)<=(A*x+B*y)*E){
          // cout<<x<<y<<z<<w<<endl;
          if(x+y==0){
            w++;
            continue;
          }
          if((double)(C*z+D*w)/(double)(100*(A*x+B*y)+(C*z+D*w))>=(double)ans2/(double)ans1){
            ans1=100*(A*x+B*y)+(C*z+D*w);
            ans2=(C*z+D*w);
          }
          w++;
        }
        z++;
      }
      y++;
    }
    x++;
  }
  cout<<ans1<<" "<<ans2;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string input;
    string tenki[3] = {"Sunny", "Cloudy", "Rainy"};
    cin>>input;
    if(input == tenki[0]){
        cout << tenki[1];
    }else if(input==tenki[1]){
        cout << tenki[2];
    }else{
        cout << tenki[0];
    }
    return 0;
}


Measured memory_bytes: 256
N=int(input())
L=[[0 for i in range(8)]for j in range(8)]

Q=[]

for i in range(N):
    h,w=map(int,input().split())
    Q.append((h,w))
    #L[h][w]="Q"
if N==8:
    L=[["." for i in range(8)]for j in range(8)]
    for q in Q:
        #print(q)
        L[q[0]][q[1]]="Q"
    for h in range(8):
        print("".join(L[h]))
    exit()
    
for i in range(len(Q)):
    H,W=Q[i]
    for j in range(1,8):
        if H+j>=8 or W+j>=8:
            break
        L[H+j][W+j]=1
    for j in range(1,8):
        if H+j>=8 or W-j<0:
            break
        L[H+j][W-j]=1
    for j in range(1,8):
        if W+j>=8 or H-j<0:
            break
        L[H-j][W+j]=1
    for j in range(1,8):
        if H-j<0 or W-j<0:
            break
        L[H-j][W-j]=1
    for j in range(1,8):
        if W+j>=8:
            break
        L[H][W+j]=1
    for j in range(1,8):
        if W-j<0:
            break
        L[H][W-j]=1
    for j in range(1,8):
        if H+j>=8:
            break
        L[H+j][W]=1
    for j in range(1,8):
        if H-j<0:
            break
        L[H-j][W]=1
for i in Q:
    L[i[0]][i[1]]="Q"
#print(L)
#for i in range(8):
    #print(L[i])
d=[]
for i in range(8):
    for j in range(8):
        if L[i][j]==0:
            d.append((i,j))

D=[{}for i in range(8)]
D[0][tuple(Q)]=d
#print(D)
import copy
for i in range(1,8-N):
    for k,v in D[i-1].items():
        K=list(k)
        for x in range(len(v)):
            l=[]
            for y in range(x+1,len(v)):
                if x==y:
                    continue
                if abs(v[x][0]-v[y][0])==abs(v[x][1]-v[y][1]) or (v[x][0]-v[y][0])*(v[x][1]-v[y][1])==0:
                    continue
                else:
                    l.append(v[y])
            #print(v[x][0],v[x][1])
            D[i][tuple(K+[v[x]])]=l
#print(D[8-N-1])
for k,v in D[8-N-1].items():
    if len(v)==1:
        
        for i in k:
            L[i[0]][i[1]]="Q"
        L[v[0][0]][v[0][1]]="Q"
        for h in range(8):
            for w in range(8):
                if L[h][w]!="Q":
                    L[h][w]="."
        for h in range(8):
            print("".join(L[h]))
        exit()


Measured memory_bytes: 6472
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

h, w = map(int, input().split())
ini_grid = []
ans = 0
for i in range(h):
    s = list(input())
    ini_grid.append(s)

dd = [(1, 0), (-1, 0), (0, 1), (0, -1)]
for i in range(h):
    for j in range(w):
        if ini_grid[i][j] == '.':
            temp_grid = [row[:] for row in ini_grid]
            dis_grid = [[-1]*w for i in range(h)]
            dis_grid[i][j] = 0
            dq = deque([(i, j, 0)])
            temp_grid[i][j] = '#'
            while dq:
                curr = dq.popleft()
                for di, dj in dd:
                    ni = curr[0] + di
                    nj = curr[1] + dj 
                    if (0 <= ni <= h-1) and (0 <= nj <= w-1) and temp_grid[ni][nj] == '.':
                        temp_grid[ni][nj] = '#'
                        dis_grid[ni][nj] = curr[2] + 1
                        dq.append((ni, nj, curr[2] + 1))
                        if curr[2] + 1 > ans:
                            ans = curr[2] + 1

print(ans)

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




int main(){

  string s;
  cin>>s;
  
  vector<char>vec(4);
  for(int i=0;i<4;i++){
    vec[i]=s[i];
  }
  sort(vec.begin(),vec.end());
  if(vec[0]==vec[1] && vec[2]==vec[3]){
    if(vec[0]!=vec[2]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  }else{
    cout<<"No"<<endl;
  }
}


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    int ans = 1;
    map<int, int> mp;
    if(n%2==0){
        REP(i,n){
            if(a[i]%2==0){
                ans = 0; break;
            }
            mp[a[i]]++; 
        }
    } else {
        REP(i,n){
            if(a[i]%2==1){
                ans = 0; break;
            }
            mp[a[i]]++;
        }
    }
    if(ans!=0){
        for(auto e: mp){
            if(e.first != 0 && e.second != 2){
                ans = 0;
                break;
            }
            if(e.first == 0 && e.second != 1){
                ans = 0; break;
            }
        }
    }
    if(ans!=0){
        REP(i,n/2){
            ans*=2;
            ans%=1000000007;
        }
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace  std;

const int FACT_MAX = 200005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint n, k;

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

  cin >> n >> k;
  for(int i = 1; i <= k; i++){
    if(n-k+1 < i){
      cout << 0 << endl;
      continue;
    }
    llint ans = comb(k-1, k-i) * comb(n-k+1, i) % mod;
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3456