akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " "
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;cin >> N >> M;
    vector<ll> vec(N);
    vecin(vec);
    rep(i,N - 1)vec[i + 1] += vec[i];
    ll ans = 0;
    rep(i,N){
        if(vec[i] <= M)ans++;
        else break;
    }
    cout << ans + 1 << endl;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

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

using ll = long long;

using namespace std;

int A[3][3];

bool bingo() {
  REP(i, 3) {
    bool ok = true;
    REP(j, 3) if (A[i][j] > 0) ok = false;
    if (ok) return true;
  }
  REP(i, 3) {
    bool ok = true;
    REP(j, 3) if (A[j][i] > 0) ok = false;
    if (ok) return true;
  }
  {
    bool ok = true;
    REP(i, 3) {
      if (A[i][i] > 0) ok = false;
    }
    if (ok) return true;
  }
  {
    bool ok = true;
    REP(i, 3) {
      if (A[i][2 - i] > 0) ok = false;
    }
    if (ok) return true;
  }
  return false;
}

int main() {
  REP(i, 3) REP(j, 3) cin >> A[i][j];
  int N;
  cin >> N;
  REP(n, N) {
    int b;
    cin >> b;
    REP(i, 3) REP(j, 3) if (A[i][j] == b) A[i][j] = 0;
  }
  cout << (bingo() ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int MAX=105;
struct Node{
	int parent,left,right;
	Node():parent(-1),left(-1),right(-1){}
}T[MAX];
int pre[MAX],in[MAX];
int n,cnt=0;
int build(int pl,int pr,int il,int ir){
	if(ir<il||pr<pl||pl<0||pr>=n) return -1;
	if(pr==pl) return pre[pl];
	int root=pre[pl];
	int p;
	for(int i=il;i<=ir;i++)
		if(in[i]==root)p=i;
	int left=build(pl+1,pl+p-il,il,p-1);
	T[root].left=left;
	if(left!=-1)T[left].parent=root;
	int right=build(pl+p-il+1,pr,p+1,ir);
	T[root].right=right;
	if(right!=-1)T[right].parent=root;
	return root;
}
void postorder(int i){
	if(T[i].left!=-1)postorder(T[i].left);
	if(T[i].right!=-1)postorder(T[i].right);
	printf("%d",i);
	if(cnt!=n-1)cout<<" ";
	cnt++;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++) cin>>pre[i];
	for(int i=0;i<n;i++) cin>>in[i];
	build(0,n-1,0,n-1);
	int p=1;
	while(T[p].parent!=-1)p=T[p].parent;
	postorder(p);
	cout<<endl;
	return 0;
}




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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  int a = 0, b = 0, c = 0;
  char next = 'a';
  while (true) {
    if (next == 'a') {
      if (a == s1.size()) {
        cout << "A" << endl;
        return 0;
      }
      next = s1[a];
      a++;
    } else if (next == 'b') {
      if (b == s2.size()) {
        cout << "B" << endl;
        return 0;
      }
      next = s2[b];
      b++;
    } else {
      if (c == s3.size()) {
        cout << "C" << endl;
        return 0;
      }
      next = s3[c];
      c++;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, m;

int main()
{
  cin >> m>>n;
  cout << 6 - m-n << endl;
}


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

using Gragh = vector<vector<int>>;
using pint  = pair<int,int>;

Gragh G;
int N, M;
int s, t;
void solve(){
    vector<vector<long long>> dist(N, vector<long long>(3, -1));
    queue<pint> que;
    que.push({s, 0});
    dist[s][0] = 0;
    while(!que.empty()){
        pint cur = que.front(); que.pop();
        int u = cur.first;
        int parity = cur.second;
        for(int i = 0; i < G[u].size(); i++){
            int v = G[u][i];
            int np = (parity + 1) % 3;
            if(dist[v][np] == -1){
                que.push({v,np});
                dist[v][np] = dist[u][parity] + 1;
            }
        }
    }
    if(dist[t][0] == -1) cout << -1 << endl;
    else cout << dist[t][0] / 3 << endl;
}

int main(){
    cin >> N >> M;
    G.assign(N, vector<int>());
    for(int i = 0; i < M ; i++){
        int u,v; cin >> u >> v; u--,v--;
        G[u].push_back(v);
    }
    cin >> s >> t; s--, t--;
    solve();
}


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

int n;
vector<string> woo[200001];
string s;
map<string, int> votes;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        votes[s]++;
    }

    int maxT = 1;

    for (auto x : votes)
    {
        maxT = max(maxT, x.second);
        woo[x.second].push_back(x.first);
    }

    sort(woo[maxT].begin(), woo[maxT].end());

    for (auto x : woo[maxT])
    {
        cout << x << '\n';
    }
}

Measured memory_bytes: 30192
#include <stdio.h>
int main(void){
    int a,b,tmp_a,tmp_b,af,bf;
    
    scanf("%d%d",&a,&b);
    
    af=a/0.08+0.5;
    tmp_a=af;
    bf=b/0.1+0.5;
    tmp_b=bf;
    af=bf*0.08;
    bf=tmp_a*0.1;
 
    if(a==af&&b==bf){
        if(a<b){printf("%d\n",tmp_b);}
        else{printf("%d\n",tmp_a);}
    }
    else if(a==af){printf("%d\n",tmp_b);}
    else if(b==bf){printf("%d\n",tmp_a);}
    else{printf("-1\n");}
    
    return 0;
}


Measured memory_bytes: 128
h,w = map(int,input().split())
meiro = [list(input()) for i in range(h)]
max_d = 0
from collections import deque

def bfs(sx,sy):
    que = deque([(sx,sy,0)])
    d = [[0]*w for i in range(h)]
    d[sx][sy] = 1
    max_len=0
    while que:
        x,y,tmp_len = que.popleft()
        for dx,dy in [(0,1),(1,0),(-1,0),(0,-1)]:
            tmp = tmp_len
            nx,ny = x+dx,y+dy
            if 0 <= nx < h and 0 <= ny < w and d[nx][ny] == 0 and meiro[nx][ny] =='.':
                d[nx][ny] = 1
                max_len = max(max_len, tmp+1)
                que.append((nx,ny,tmp+1))
    return max_len

for s_i in range(h):
    for s_j in range(w):
        if meiro[s_i][s_j] == "#":
            continue
        max_d = max(bfs(s_i,s_j), max_d)
print(max_d)

Measured memory_bytes: 44396
n = int(input()) - 1
a = list(map(int, input().split()))
a.sort(reverse = True)
if n % 2 == 1:
    t = n//2 + 1
    ans = sum(a[:t]) * 2 - a[0]
else:
    t = n // 2
    ans = sum(a[:t]) * 2 - a[0] + a[t]
print(ans)

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

int main() {
  string S;
  cin >> S;
  string answer;
  if (S == "Sunny") {
    answer = "Cloudy";
  }
  else if (S == "Cloudy") {
    answer = "Rainy";
  }
  else {
    answer = "Sunny";
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
N=int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
happy=0
for i in range(0,N-1):
  happy+=B[A[i]-1]
  if A[i+1] == A[i] + 1:
    happy+=C[A[i]-1]
happy+=B[A[N-1]-1]
print(happy)

Measured memory_bytes: 3064
import sys
n = int(input())
h = [int(e) for e in input().split()]
for i in range(n - 2, 0, -1):
  if h[i] > h[i + 1]:
    h[i] -= 1
  if h[i] > h[i + 1]:
    print('No')
    sys.exit()
print('Yes')


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector> 
using namespace std;
typedef long long ll;
const int N=1e5+20;
const ll mod=400;
ll n,x; 
ll a[N];
int main()
{
	cin>>n>>x;
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		//要求相邻的两个a[i]之和都小于x,所以每个a[i]都必须<=x 
		if(a[i]>x)
		{
			ans+=a[i]-x;
			a[i]=x;
		}
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]+a[i-1]>x)
		{
			ans+=a[i]+a[i-1]-x;
			a[i]-=a[i]+a[i-1]-x;
		}
	}
	cout<<ans<<endl;
	
	
	return 0;
}

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

int main(){
string s;
int A=0,B=0,O=0,AB=0;
while(cin>>s){
for(int i=0;;i++){
if(s[i]==','){
if(s[i+1]=='A'&&s[i+2]=='\0')A++;
if(s[i+1]=='A'&&s[i+2]=='B')AB++;
if(s[i+1]=='B')B++;
if(s[i+1]=='O')O++;
break;}}}
cout<<A<<endl<<B<<endl<<AB<<endl<<O<<endl;}

Measured memory_bytes: 1176
N = int(input())
t=[[0,0,0]]
for i in range(N):
    A=list(map(int, input().strip().split()))
    t.append(A)

flag=0
flag2=0
for i in range(N):
    flag=0
    time=t[i+1][0]-t[i][0]
    x=t[i+1][1]-t[i][1]
    y=t[i+1][2]-t[i][2]
    time=abs(time)
    x=abs(x)
    y=abs(y)
    
    if (time-(x+y))%2==0 and time>=(x+y):
        flag=1
    if flag!=1:
        flag2=1    

if flag2==1:
    print("No")
else:
    print("Yes")




Measured memory_bytes: 27120
#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>

using namespace std;
using Map = map<pair<int,int>, int>;

int get_smallest_hop(int i, int prev, const vector<vector<int>>&vec, Map&memo)
{
  if (i == 0) return max(vec[0][0], max(vec[1][0], vec[2][0]));
  int ret = 0;
  for (int j = 1; j <= 3; ++j){
    if (prev != j){
      int p;
      auto key = make_pair(i-1, j);
      if (memo.find(key)!=memo.end()) {
    		p = memo[key];
      } else {
   			p = memo[key] = get_smallest_hop(i-1, j, vec, memo);
 	  }
      ret = max(ret, vec[j-1][i] + p);
    }
  }

  return ret;
}


int main()
{
  int n; cin >> n;
  vector<int> a,b,c;
  
  for (int i = 0; i < n; ++i) {
    int ta,tb,tc; cin >> ta >> tb >> tc;
    a.push_back(ta);
    b.push_back(tb);
    c.push_back(tc);
  }
  
  Map memo;
  vector<vector<int>> vec {a,b,c};
  cout << get_smallest_hop(n-1,0, vec, memo);
  return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    if (i % 2 == 0) {
      ans += a[i];
    } else {
      ans -= a[i];
    }
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int a, b;
  cin >>a >> b;
  int ans;
  ans = 6 - a- b;
  cout << ans << endl;

  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("dichromatic.in","r",stdin)
#define OUT freopen("dichromatic.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2
#define sq(x)  ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

queue< pair<int,int> > q ;

int dis[1005][1005] ;
char s[1005][1005] ;

int dx[] = {0,0,1,-1} ;
int dy[] = {1,-1,0,0} ;

int main()
{
    int n , m ;

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

    for(int i=0 ; i<n ; i++) scanf("%s",s[i]) ;

    memset(dis,-1,sizeof(dis)) ;

    for(int i=0 ; i<n ; i++)
    {
        for(int j=0 ; j<m ; j++)
        {
            if( s[i][j]=='#' ) dis[i][j] = 0 , q.push( mp(i,j) ) ;
        }
    }
    int ans = 0 ;
    while( !q.empty() )
    {
        pair<int,int> p = q.front() ;
        q.pop() ;

        for(int i=0 ; i<4 ; i++)
        {
            int x = p.xx + dx[i] , y = p.yy + dy[i] ;
            if( x <0 || x>=n || y <0 | y>=m ) continue ;

            if( dis[x][y] == -1 )
            {
                q.push( mp( x,y ) ) ;
                dis[x][y] = dis[p.xx][p.yy] + 1 ;
                ans = dis[x][y] ;
            }
        }
    }

    printf("%d\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 13328
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main() {
  LL A, B, Q;
  cin >> A >> B >> Q;
  vector<LL> a(A), b(B);
  for (int i = 0; i < A; i ++) cin >> a[i];
  for (int i = 0; i < B; i ++) cin >> b[i];

  LL x, j1, j2, k1, k2;
  for (int i = 0; i < Q; i ++) {
    cin >> x;

    j1 = lower_bound(a.begin(), a.end(), x) - a.begin();
    k1 = lower_bound(b.begin(), b.end(), x) - b.begin();
    j2 = j1 - 1;
    k2 = k1 - 1;

    LL res = 1e18;
    if (j1 < A && k1 < B) {
      res = min(res, (a[j1] - x) + abs(a[j1] - b[k1]));
      res = min(res, (b[k1] - x) + abs(a[j1] - b[k1]));
    }
    if (j2 >= 0 && k2 >= 0) {
      res = min(res, (x - a[j2]) + abs(a[j2] - b[k2]));
      res = min(res, (x - b[k2]) + abs(a[j2] - b[k2]));
    }
    if (j1 < A && k2 >= 0) {
      res = min(res, (a[j1] - x) + abs(a[j1] - b[k2]));
      res = min(res, (x - b[k2]) + abs(a[j1] - b[k2]));
    }
    if (j2 >= 0 && k1 < B) {
      res = min(res, (x - a[j2]) + abs(a[j2] - b[k1]));
      res = min(res, (b[k1] - x) + abs(a[j2] - b[k1]));
    }

    cout << res << endl;
  }
}


Measured memory_bytes: 2944
#include <iostream>

using namespace std;

void insert(int* array, int index, int size, int num){
  for(int i = (size-1); i > index; i--){
    *(array + i) = *(array + i - 1);
  }
  *(array + index) = num;
}

void rqsort(int* array, int size, int num){
  for(int i = 0; i < size; i++){
    if(*(array + i) < num){
      insert(array, i, size, num);
      return;
    }
  }
}

int main(int argc, char const *argv[]) {

  int ans[3] = {0,0,0};
  int n;
  for(int i = 0; i < 10; i++){
    cin >> n;
    rqsort(ans, 3, n);
  }
  for(int i = 0; i < 3; i++){
    cout << ans[i] << endl;
  }
  return 0;
}



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

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair

int intcmp(const void *v1,const void *v2){return *(int *)v1-*(int *)v2;}


// n/s(n) <= m/s(m)
//
//
// n 最后一位一定是9 -> s(n) > s(m)
//

// 119/(1+1+9) <=?<= (129)/(1+2+9)

// 1 -> 9
// 19 -> 99
// 


// (x -sum(x)+1-9*n) <= 0
// x-sum(x) <= 9*n-1
//
// n = 2 -> <= 17
// 10 - 1 < 17
//
//
// [x n]

map<ll,int> vis;
vector<ll>ans;

int getsum(ll v){
  int ret = 0;
  while(v!=0){
    ret+=v%10;
    v/=10;
  }
  return ret;
}


void vectorpbwrap(ll v){
  if(vis.count(v) == 0){
    ans.pb(v);
    vis[v] = 1;
  }
}

ll vgen(int i,int len){
  ll ret = i;
  while(len-- > 0){
    ret*=10;
    ret+=9;
  }
  return ret;
}

void init(){
  rep(i,1,10){
    ans.pb(vgen(i,0));
  }
  rep(len,1,15){
    int x;
    for(x=1;(x-getsum(x)) <= 9*len-1;x++ )
      vectorpbwrap(vgen(x,len));
  }
  sort(ans.begin(),ans.end());
}

int main(){
  init();
  // for(auto item:ans){
  //   cout<<item<<endl;
  // }
  // cout<<1'000'000'000'000'000<<endl;
  int n;
  cin>>n;
  rep(i,0,n){
    cout<<ans[i]<<endl;
  }

  return 0;
}



Measured memory_bytes: 384
using System;
using System.Linq;

namespace AtCoderPractice0704
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            long[] NR = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

            long  N = NR[0];
            long  R = NR[1];
            long ans;

            if (N >= 10)
            {
                ans = R;
            }
            else
            {
                ans = R + 100 * (10 - N);
            }

            Console.WriteLine(ans);
        }
    }
}


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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int>a(m),b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
  }
  map<int,int>mp;
  for(int x:a){
    if(mp.count(x)){
      mp.at(x)++;
    }else{
      mp[x]=1;
    }
  }
  for(int x:b){
    if(mp.count(x)){
      mp.at(x)++;
    }else{
      mp[x]=1;
    }
  }
  vector<int>kotae(n,0);
  auto begin=mp.begin(),end=mp.end();
  for(auto iter=begin;iter!=end;iter++){
    int c=iter->first;
    int d=iter->second;
    kotae[c-1]=d;
  }
  for(int i=0;i<n;i++){
    cout<<kotae[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a[10];
    for(int i=0;i<3;i++)
    {
        cin >> a[i];
    }
    
    sort(a,a+3);
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
}


Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    int N, R;
    cin>>N>>R;
    if(N>=10) cout<<R<<endl;
    else cout<<R+100*(10-N)<<endl;
    return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
	int n;
	while(cin >> n,n!=-1){
		int ans=1150;
		if(n>10)ans+=min(10,n-10)*125;
		if(n>20)ans+=min(10,n-20)*140;
		if(n>30)ans+=(n-30)*160;
		cout << 4280-ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2980
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string s;
	string ans="";
	cin>>s;
	rep(i,s.size()){
		int num=(int)s[i]-'A';
		if(num-3<0)num+=26;
		num=(num-3)%26;
		ans+=(char)(num+'A');
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long int Int;

Int field[100*100];
int main(void) {
    Int h,w,n;
    Int head = 0;

    cin>>h>>w;
    cin>>n;

    for(int i = 0;i < n;i++) {
	Int a;
	cin>>a;

	for(;a > 0;a--)
	{
	    field[head++] = i+1;
	}
    }

    for(int row = 0;row < h;row++) {
	if(row % 2 == 0)
	{
	    for(int col = 0;col < w;col++)
	    {
		cout<<field[row*w+col];
		if(col != w-1)
		    cout<<" ";
		else
		    cout<<endl;
	    }
	} else {
	    for(int col = w-1;col >= 0;col--) {
		cout<<field[row*w+col];
		if(col != 0)
		    cout<<" ";
		else
		    cout<<endl;
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 384
(h,w),*a=[map(int,o.split())for o in open(0)]
B=[];l=[]
for y in range(h):
 *A,=a[y]
 for x in range(1,w):c=A[x-1]%2;l+=[(y+1,x,y+1,x+1)]*c;A[x]+=c
 B+=A[w-1],
 if y and B[-2]%2:l+=(y,w,y+1,w),;B[y]+=1
print(len(l))
for a in l:print(*a)

Measured memory_bytes: 26532
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
   int n,m,sum = 0;
   cin >> n >> m;
   int a[n];
   for(int i = 0;i < n;i++){
       cin >> a[i];
       sum += a[i];
   }
   sort(a,a+n,greater<int>());
   if(a[m-1] >=(double)sum/(double)(m*4))cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<set>
#include<map>
#include<stack>
#define i64 long long
#define vi32 vector<int>
#define vi64 vector<long long>
#define  ii pair<int,int>
const long long mod = 1000000007LL, inf = 1e9, linf = 1e18;
using namespace std;
#define pb push_back
#define mp make_pair
#define N 100005	
using namespace std;
pair<string, ii> f[N];
bool cmd(pair<string, ii> a, pair<string, ii> b)
{
	if (a.first == b.first)return a.second > b.second;
	return(a.first < b.first);
}
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> f[i].first >> f[i].second.first, f[i].second.second = i;
	sort(f + 1, f + 1 + n, cmd);
	for (int i = 1; i <= n; i++)
		cout << f[i].second.second << endl;
}



Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int a[1010][1010],b[1010][1010];
int s1[1010][1010],s2[1010][1010];
int n,m;
char c[10];
int dfs(int x,int y)
{
    int i=0,j=0;
    i=s1[m][m]-s1[x][m]-s1[m][y]+s1[x][y]*2;
    i=i+s2[x][m]+s2[m][y]-s2[x][y]*2;
    j=s2[m][m]-s2[x][m]-s2[m][y]+s2[x][y]*2;
    j=j+s1[x][m]+s1[m][y]-s1[x][y]*2;
    return max(i,j);
}
int main()
{
    int i,j,k,x,y,ans;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
    {
        scanf("%d%d%s",&x,&y,c);
        j=x%m;
        k=y%m;
        if(j==0)
            j=m;
        if(k==0)
            k=m;
        if(((abs(x-j)+abs(y-k))/m)%2==1)
        {
            if(c[0]=='W')
                c[0]='B';
            else
                c[0]='W';
        }
        if(c[0]=='W')
            a[j][k]++;
        else
            b[j][k]++;
    }
    for(i=1;i<=m;i++)
    for(j=1;j<=m;j++)
    {
        s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1]+a[i][j];
        s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1]+b[i][j];
    }
    ans=0;
    for(i=0;i<=m;i++)
    for(j=0;j<=m;j++)
    ans=max(ans,dfs(i,j));
    printf("%d\n",ans);
}

Measured memory_bytes: 16000
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N;
ll a[300010];
bool comp(ll& a,ll& b){
  return a>b;
}
int main(){
  cin>>N;
  rep(i,3*N) cin>>a[i];
  std::sort(a,a+3*N,comp);
  ll res=0;
  rep(i,N){
    res+=a[2*i+1];
  }
  prin(res);
  return 0;
}


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

using namespace std;
vector<int> ch(26);

bool isp(string s) {
  int sl = s.length();
  for (int i = 0; i < sl / 2; i++) {
    if (s[i] != s[sl - 1 - i]) {
      return false;
    }
  }
  return true;
}

int main() {
  string s;
  cin >> s;
  int ans = 0;
  int len = s.length();

  vector <int> f;
  vector <int> l;
  
  //cerr << scut << endl;


  int si = 0;
  int ei = len-1;
  while (true) {
    int fx = 0;
    int lx = 0;
    while(s[si] == 'x'){
      si++;
      fx++;
    }
    while(s[ei] == 'x'){
      ei--;
      lx++;
    }

    //cerr << fx << lx << endl;

    f.push_back(fx);
    l.push_back(lx);

    if(s[si] != s[ei]){
      
          cout << -1 << endl;
          return 0;
          }
    if(ei - si <= 1){
      break;
    }

    si++;
    ei--;



  }

  for(int i = 0; i < f.size(); i++){
    ans += abs(f[i] - l[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(0, c-(a-b)) << endl;


}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

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

    static class WriteandErase {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            Map<Long, Long> map = new HashMap<>();

            for (int i = 0; i < n; i++) {
                long a = in.nextLong();
                map.put(a, map.getOrDefault(a, 0L) + 1);
            }

            long result = 0;
            for (Long key : map.keySet()) {
                if (map.get(key) % 2 == 1) {
                    result++;
                }
            }

            out.print(result);
        }

    }
}



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

using namespace std;

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

    string s;
    cin >> s;
    int rock = 0, paper = 0;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'g') {
            if (paper < rock) {
                paper++;
                ans++;
            }
            else rock++;
        }
        else {
            if (paper < rock) paper++;
            else {
                rock++;
                ans--;
            }
        }
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    FOR(i,1,10) {
        FOR(j,1,10) {
            cout << i << "x" << j << "=" << i * j << endl;
        }
    }
    return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    //要素数n,初期値0
    vector<int> city(n,0);
    int a,b;
    rep(i,m){
        cin >> a;
        city.at(a-1) ++;
        cin >> b;
        city.at(b-1) ++;
    }
    rep(i,n){
        cout << city.at(i) << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    int main() {
        int a, b, c, d, e, f;
        double bestc = -1;
        int bestw, bests;
     
        scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
     
        double node = (100.*e)/(100+e);
        for (int bi=0; 100*b*bi <= f; bi++) {
            for (int ai=0; 100*b*bi + 100*a*ai <= f; ai++) {
                for (int di=0; 100*b*bi + 100*a*ai + d*di <= f; di++) {
                    for (int ci=0; 100*b*bi + 100*a*ai + d*di + c*ci <= f; ci++) {
                        if (!ai && !bi && !ci && !di) continue;
                        //cout << ai << bi << ci << di << endl;
                        double conc = 100.*(d*di+c*ci) / (100*b*bi+100*a*ai+d*di+c*ci);
                        if (conc <= node && conc > bestc) {
                            bestc = conc;
                            bestw = 100*(a*ai + b*bi);
                            bests = c*ci + d*di;
                        }
                    }
                }
            }
        }
     
        printf("%d %d", bestw+bests, bests);
     
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  string s;
  cin >> s;
  ll ans = 0;
  ll n = SZ(s);
  REP(i, n) FOR(j, i, n) {
    bool ok = true;
    FOR(k, i, j + 1) {
      if (s[k] != 'R') {
        ok = false;
      }
    }
    if (ok) {
      ans = max(ans, j - i + 1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Arrays;

public class Main {
	public static class SegmentTree {
		int[] tree;
		public SegmentTree(int n) {
			int d = (int)Math.ceil(Math.log((double)n) / Math.log(2.0));
			tree = new int[(int)Math.pow(2, d+1)];
			Arrays.fill(tree, Integer.MAX_VALUE);
		}

		public void update(int i, int x) {
			i += tree.length/2-1;
			tree[i] = x;
			while(i > 0) {
				i = (i - 1) / 2;
				tree[i] = Math.min(tree[i*2+1], tree[i*2+2]);
			}
			// print();
		}

		// usage
		// query(a, b, 0, 0, seg.tree.length/2)
		public int query(int a, int b, int k, int l, int r) {
			// System.out.println(a+" "+b+" "+k+" "+l+" "+r);
			if(r <= a || b < l) return Integer.MAX_VALUE;
			if(a <= l && r-1 <= b) return tree[k];
			else {
				int vl = query(a, b, k*2+1, l, (l+r)/2);
				int vr = query(a, b, k*2+2, (l+r)/2, r);
				return Math.min(vl, vr);
			}
		}

		public void print() {
			for(int i=0; i<tree.length; i++) {
				System.out.print(tree[i]+" ");
			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
		FS r = new FS();
		int n = r.nextInt();
		int q = r.nextInt();
		SegmentTree seg = new SegmentTree(n);
		for(int i=0; i<q; i++) {
			int c = r.nextInt();
			int x = r.nextInt();
			int y = r.nextInt();
			if(c == 0) {
				seg.update(x, y);
			} else {
				System.out.println(seg.query(x, y, 0, 0, seg.tree.length/2));
			}
		}
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}

Measured memory_bytes: 37200
S = input()
size = len(S)
A = ""
B = ""
countA = 0
countB = 0
if size%2 == 0:
    cnt = int(size/2)
    for _ in range(cnt):
        A = A+"01"
        B = B+"10"
else:
    cnt = int((size-1)/2)
    for _ in range(cnt):
        A = A +"01"
        B = B + "10"
    A = A + "0"
    B = B + "1"
for i in range(size):
    if S[i] != A[i]:
        countA += 1
    if S[i] != B[i]:
        countB += 1
print(min(countA,countB))

Measured memory_bytes: 3316
#include <cstdio>

int main()
{
  int h,w;
  scanf("%d%d",&h,&w);
  char M[510][510];
  for(int i=0;i<h;i++){
    scanf("%s",M[i]);
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      putchar(i==0||(i!=h-1&&(j%2==0||M[i][j]=='#'))?'#':'.');
    }
    putchar('\n');
  }
  putchar('\n');
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      putchar(i==h-1||(i!=0&&(j%2==1||M[i][j]=='#'))?'#':'.');
    }
    putchar('\n');
  }
  return 0;
}


Measured memory_bytes: 896
class Q1042
  def doIt
    eoi = "END OF INPUT"
    str = gets
    str = str[0..(str.length - 2)]
    while str != eoi
      calc str
      str = gets
      str = str[0..(str.length - 2)]
    end
  end
  
  def calc str
#    puts "calc : " + str
    #array = str.split(" ")
    array = str.split(/\s/)
    len = array.length - 1
    for i in 0..len
      print array[i].length
    end
    puts
  end
end

Q1042.new.doIt

Measured memory_bytes: 2384
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
town=[0]
set={0}
i=0
while True:
  idx=town[-1]
  if a[idx] in set:
    s=a[idx]
    i+=1
    break
  else:
    i+=1
    town.append(a[idx])
    set.add(a[idx])
if i!=n:
  idp=town.index(s)
  chain=len(town[:idp])
  cycle=len(town[idp:])
  if k<=chain:
    print(town[k]+1)
  else:
    p=(k-chain)%cycle + chain
    print(town[p]+1)
else:
  print(town[k%n]+1)

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

int main(){
    string o,e;
    cin >> o >> e;
    if(o.size() > e.size()){
        for(int i = 0; i < e.size(); i++){
            cout << o[i] << e[i];
        }
        cout << o[o.size()-1] << endl;
    }else{
        for(int i = 0; i < o.size(); i++){
            cout << o[i] << e[i];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
/*
        karmany evadhikaras te
        ma phalesu kadacana 
        ma karma-phala-hetur bhur
        ma re sango'stv akarmani (B.G.-2.47)
 
Translation:
        Lord Krsna to Arjuna.
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results of your activities, 
and never be attached to not doing your duty.    
*/
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define int long long
const int N = 200005;
const ll mod = 2000000011;
#define ld long double
#define PI 3.14159265358979323846
const int X = 10000000;

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(20);
}

//3. Structure or classes
//3. Ends here

//1. Data structures declaration here
vector<int>Next;
//1. Ends here

//2. Extra Functions here
//2. Ends here


void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    for(int i=1;i<=t;i++){
        solve();
    }
    return 0;
}

void solve()
{
    int n;
    cin>>n;
    int ans = (n*(n-1))/2;
    cout<<ans;
    return;
}

Measured memory_bytes: 3660
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#include <stdio.h>
#include <sstream>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N), y(M);
	rep(i, 0, N) cin >> x[i];
	rep(i, 0, M) cin >> y[i];

	x.pb(X); y.pb(Y);
	SORT(x); SORT(y);

	if (x[N] < y[0]) cout << "No War" << endl;
	else cout << "War" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
unordered_map<ll,ll> mas;
int main(){
  ll n,a;cin>>n;
  bool non=0;
  for(int i=0;i<n;i++){
      cin>>a;
      if(a>0)non=1;
      mas[a]++;
  }
  if(n%3>0){
      if(non==0)cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
      return 0;
  }
  vector<ll> v;
  for(auto t:mas){
      ll x=t.second;
      if(x%(n/3)>0){
	  cout<<"No"<<endl;
	  return 0;
      }
      for(ll i=0;i<x/(n/3);i++)v.push_back(t.first);
  }
  if((v[0] xor v[1])==v[2])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

int main() {
  while(1){
    int n,m;
    cin >> n >> m;
    if(n==0 &&m==0)break;
    vector <int> N;
    for(int i=0;i<n;i++) N.push_back(i+1);
    int ima=0;
    while(N.size()!=1)ima=(ima+m-1)%N.size(),N.erase(N.begin()+ima);
    cout << N[0] <<endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
    int N;
    scanf("%d",&N);
    int a[N],i,j,min;
    for(i=0; i<N; i++)
        scanf("%d",&a[i]);
    for(i=0; i<N-1; i++)
    {
        min=i;
        for(j=i; j<N; j++)
            if(a[j]<a[min])
                min=j;
        int temp=a[i];
        a[i]=a[min];
        a[min]=temp;
    }
    int max=1e9;
    for(i=a[0]; i<=a[N-1]; i++)
    {
        int sum=0;
        for(j=0; j<N; j++)
            sum+=(a[j]-i)*(a[j]-i);
            if(sum<=max)
                max=sum;
    }

printf("%d\n",max);

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <cassert>

using namespace std;


class Solution{

private:
    const long long MOD = 1e9 + 7;
public:
    int sum(int N, int C, const vector<int>& A, const vector<int>& B){

        int max_num = *max_element(A.begin(), A.end());
        max_num = max(max_num, *max_element(B.begin(), B.end()));

        vector<vector<long long>> mypow(max_num + 1, vector<long long>(C + 1, 1ll));
        for(int i = 2; i <= max_num; i ++)
            for(int j = 1; j <= C; j ++)
                mypow[i][j] = mypow[i][j - 1] * i % MOD;

        vector<vector<long long>> sum(N, vector<long long>(C + 1, 0ll));
        for(int i = 0; i < N; i ++)
            for(int c = 0; c <= C; c ++){
                sum[i][c] = 0ll;
                for(int x = A[i]; x <= B[i]; x ++)
                    sum[i][c] += mypow[x][c], sum[i][c] %= MOD;
            }

        vector<vector<long long>> res(C + 1, vector<long long>(N, 1ll));
        for(int c = 0; c <= C; c ++){
            res[c][0] = sum[0][c];
            for(int i = 1; i < N; i ++){
                res[c][i] = 0ll;
                for(int e = 0; e <= c; e ++)
                    res[c][i] += sum[i][e] * res[c - e][i - 1] % MOD, res[c][i] %= MOD;
            }
        }
        return res[C][N - 1];
    }
};

int main() {

//    vector<int> A1 = {1, 1}, B1 = {1, 1};
//    cout << Solution().sum(2, 3, A1, B1) << endl;
//    // 4
//
//    vector<int> A2 = {1}, B2 = {3};
//    cout << Solution().sum(1, 2, A2, B2) << endl;
//    // 14
//
//    vector<int> A3 = {1, 1}, B3 = {2, 2};
//    cout << Solution().sum(2, 3, A3, B3) << endl;
//    // 66
//
//    vector<int> A4 = {3, 1, 4, 1}, B4 = {3, 1, 4, 1};
//    cout << Solution().sum(4, 8, A4, B4) << endl;
//    // 421749
//
//    vector<int> A5 = {7, 6, 5}, B5 = {9, 9, 9};
//    cout << Solution().sum(3, 100, A5, B5) << endl;
//    // 139123417

    int N, C;
    scanf("%d%d", &N, &C);

    vector<int> A(N), B(N);
    for(int i = 0 ; i < N; i ++) scanf("%d", &A[i]);
    for(int i = 0 ; i < N; i ++) scanf("%d", &B[i]);
    printf("%d\n", Solution().sum(N, C, A, B));

    return 0;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

vector<vector<lli>> friends;
map<lli,lli> colorToCnt;
lli colors[100100];
lli data[100100];

void dfs(lli now,lli color){
	if(colors[now]!=0)return;
	colors[now] = color;
	colorToCnt[color]++;
	for(auto e:friends[now]){
		dfs(e,color);
	}
}

signed main(){

	lli n,m,k;
	cin>>n>>m>>k;

	friends.resize(n);

	REP(i,0,m){
		lli a,b;
		cin>>a>>b;
		a--,b--;
		friends[a].push_back(b);
		friends[b].push_back(a);
	}

	lli color=1;
	REP(i,0,n){
		if(data[i]!=0)continue;
		dfs(i,color);color++;
	}
	REP(i,0,n){
		data[i] = colorToCnt[colors[i]];
	}

	REP(i,0,n){
		data[i] -= friends[i].size();
	}

	REP(i,0,k){
		lli c,d;
		cin>>c>>d;
		c--,d--;
		if(colors[c] == colors[d]){
			data[c]--;
			data[d]--;
		}
	}

	REP(i,0,n){
		cout<<data[i]-1<<" ";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int N;
    cin >> N;
    vint dp(N + 1);
    dp[0] = 0;
    for (int i = 1; i <= N;i++)
    {
        int min6 = N + 1,min9=N+1;
        int j = 0, k = 0;
        while(i-pow(6,j) >=0)
        {
            k = i - pow(6, j);
            if (dp[k]<min6)
            {
                min6 = dp[k];
            }
            j++;
        }
        j = 0;
        k = 0;
        while(i-pow(9,j)>=0)
        {
            k = i - pow(9, j);
            if(dp[k]<min9)
            {
                min9 = dp[k];
            }
            j++;
        }
        dp[i] = min({dp[i - 1], min6, min9}) + 1;
    }
    cout<<dp[N];
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+10;

int f[maxn];
int mark[maxn];
vector<int> vt[maxn];

int bfs(int u, int n) {
	queue<int> q;
	memset(f, 0, sizeof(f));
	memset(mark, 0, sizeof(mark));
	q.push(u);
	mark[u] = true;
	while (!q.empty()) {
		u = q.front();
		q.pop();
		for(int v:vt[u]) {
			if (!mark[v]) {
				mark[v] = true;
				f[v] = f[u] + 1;
				q.push(v);
			}
		}
	}
	return max_element(f, f+n) - f;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n = 0;
	cin >> n;
	for(int i=0;i<n - 1;i++) {
		int u, v;
		cin >> u >> v;
		u -- ;
		v -- ;
		vt[u].push_back(v);
		vt[v].push_back(u);
	}

	int u = bfs(0, n);
	int v = bfs(u, n);
	int t = f[v];
	cerr << t << endl;
	cout << ((t%3==1) ? "Second" : "First");
	return 0;
}


Measured memory_bytes: 14324
fun main() {
    val k = Integer.parseInt(readLine())
    val s = readLine()?.split(" ")?.map { Integer.parseInt(it) } ?: return
    for (i in s[0]..s[1]) {
        if (i % k == 0) {
            println("OK")
            return
        }
    }
    println("NG")
}

Measured memory_bytes: 36528
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <cstdint>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int64_t solve(vector<int64_t>& a) {
    sort(a.begin(), a.end());

    int s = 0, t = a.size() - 1;
    int b = a[s], e = a[t];
    int64_t ans = e - b;
    while (s + 1 != t) {
        vector<int64_t> l{abs(a[s + 1] - b), abs(a[s + 1] - e), abs(a[t - 1] - b), abs(a[t - 1] - e)};

        auto it = max_element(l.begin(), l.end());
        ans += *it;
        auto idx = it - l.begin();
        if (idx <= 1) {
            ++s;
            if (idx == 0) {
                b = a[s];
            } else {
                e = a[s];
            }
        } else {
            --t;
            if (idx == 2) {
                b = a[t];
            } else {
                e = a[t];
            }
        }
    }

    return ans;
}

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

    vector<int64_t> a(n);
    for (auto&& aa : a) {
        cin >> aa;
    }

    cout << solve(a) << endl;

    return 0;
}

Measured memory_bytes: 1024